From 82ec0badfddeaa80ac02490d37dc5363966db676 Mon Sep 17 00:00:00 2001 From: AlexHalbesleben Date: Mon, 19 Sep 2022 20:12:30 -0500 Subject: [PATCH 1/5] Basic type and ui --- src/components/SettingsModal.vue | 30 ++++++++++++++++++++++++++++++ src/types/Settings.ts | 10 ++++++++++ 2 files changed, 40 insertions(+) diff --git a/src/components/SettingsModal.vue b/src/components/SettingsModal.vue index a97009f..dc25f15 100644 --- a/src/components/SettingsModal.vue +++ b/src/components/SettingsModal.vue @@ -72,6 +72,36 @@ +
+ + + + + Minimum time of + + + minutes + + + {{ `day${vxm.store.settings.minimumTimeGap > 1 ? "s" : ""}` }} + after the current day + +
; dayEndTimes: Record; + useMinimumTime: boolean; + minimumDailyTime: number; + minimumTimeGap: number; + constructor({ effortWeight = 1, baseStartTime = 930, @@ -26,6 +30,9 @@ export default class Settings { dayEndTimes = {}, timeIncludesEvents = false, considerCompletedChunksOnAllDays = false, + useMinimumTime = false, + minimumDailyTime = 60, + minimumTimeGap = 1, }) { this.effortWeight = effortWeight; this.baseStartTime = baseStartTime; @@ -36,6 +43,9 @@ export default class Settings { this.dayEndTimes = dayEndTimes; this.timeIncludesEvents = timeIncludesEvents; this.considerCompletedChunksOnAllDays = considerCompletedChunksOnAllDays; + this.useMinimumTime = useMinimumTime; + this.minimumDailyTime = minimumDailyTime; + this.minimumTimeGap = minimumTimeGap; } stringToTime(str: string): number { From e14473d3f7579fb305dbd0c9ef4bffe8367ee255 Mon Sep 17 00:00:00 2001 From: AlexHalbesleben Date: Mon, 19 Sep 2022 20:17:28 -0500 Subject: [PATCH 2/5] Add chunking logic --- src/store/index.vuex.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/store/index.vuex.ts b/src/store/index.vuex.ts index 5e4340e..05f7c96 100644 --- a/src/store/index.vuex.ts +++ b/src/store/index.vuex.ts @@ -160,6 +160,13 @@ export class Store extends VuexModule { completedTimes[i] + completedEfforts[i] * this.settings.effortWeight + (this.settings.timeIncludesEvents ? eventTimes[i] : 0); + + if ( + this.settings.useMinimumTime && + i > this.settings.minimumTimeGap + ) { + combinedDayData[i] += this.settings.minimumDailyTime; + } } let dayToAssign = daysUntilDue; From 7a3b759399ee2911ca3268a70cca0e02a9538106 Mon Sep 17 00:00:00 2001 From: AlexHalbesleben Date: Mon, 19 Sep 2022 20:18:04 -0500 Subject: [PATCH 3/5] Fix logic: maximize, not add --- src/store/index.vuex.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/store/index.vuex.ts b/src/store/index.vuex.ts index 05f7c96..b61801e 100644 --- a/src/store/index.vuex.ts +++ b/src/store/index.vuex.ts @@ -165,7 +165,10 @@ export class Store extends VuexModule { this.settings.useMinimumTime && i > this.settings.minimumTimeGap ) { - combinedDayData[i] += this.settings.minimumDailyTime; + combinedDayData[i] = Math.max( + this.settings.minimumDailyTime, + combinedDayData[i] + ); } } From f45935f6c8e31cb97fdd59b2ee96244f0ff0026d Mon Sep 17 00:00:00 2001 From: AlexHalbesleben Date: Mon, 19 Sep 2022 20:18:38 -0500 Subject: [PATCH 4/5] Update step --- src/components/SettingsModal.vue | 1 + 1 file changed, 1 insertion(+) diff --git a/src/components/SettingsModal.vue b/src/components/SettingsModal.vue index dc25f15..518d70b 100644 --- a/src/components/SettingsModal.vue +++ b/src/components/SettingsModal.vue @@ -88,6 +88,7 @@ type="number" :number="true" :disabled="!vxm.store.settings.useMinimumTime" + step="5" /> minutes Date: Mon, 19 Sep 2022 20:21:06 -0500 Subject: [PATCH 5/5] Update changelog --- src/types/Changelog.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/types/Changelog.ts b/src/types/Changelog.ts index fc65636..cdc0061 100644 --- a/src/types/Changelog.ts +++ b/src/types/Changelog.ts @@ -184,4 +184,10 @@ Typing a hotkey in the description field in the task modal could open modals/tri title: "Bug fix", description: "Fix bug where tasks didn't load properly from local storage", }, + { + version: "3.8.0", + title: "Add minimum time spent setting", + description: + "Users can have the option to set all days a certain number of days following the current date to have a given minimum time spent", + }, ];