From 48945efb8cf3dc4cc06ed75f70ad5730cb1c2a15 Mon Sep 17 00:00:00 2001 From: mihaiconstantin Date: Sat, 16 May 2020 15:30:12 +0200 Subject: [PATCH 1/3] Added `totalWorkRounds` to `Timer` store --- src/renderer/store/modules/Timer.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/renderer/store/modules/Timer.js b/src/renderer/store/modules/Timer.js index cb3e101..492e778 100644 --- a/src/renderer/store/modules/Timer.js +++ b/src/renderer/store/modules/Timer.js @@ -4,6 +4,7 @@ import { defaults } from './../../utils/LocalStore' const state = { round: 1, workRounds: parseInt(localStore.get('workRounds')), + totalWorkRounds: 0, timeLongBreak: parseInt(localStore.get('timeLongBreak')), timeShortBreak: parseInt(localStore.get('timeShortBreak')), timeWork: parseInt(localStore.get('timeWork')), @@ -18,6 +19,9 @@ const getters = { workRounds() { return state.workRounds }, + totalWorkRounds() { + return state.totalWorkRounds + }, timeLongBreak() { return state.timeLongBreak }, @@ -44,6 +48,10 @@ const mutations = { state.round = 1 }, + INCREMENT_TOTAL_WORK_ROUNDS(state) { + state.totalWorkRounds += 1 + }, + RESET_DEFAULTS(state) { state.workRounds = defaults.workRounds state.timeLongBreak = defaults.timeLongBreak @@ -85,6 +93,10 @@ const actions = { commit('RESET_ROUND') }, + incrementTotalWorkRounds({ commit }) { + commit('INCREMENT_TOTAL_WORK_ROUNDS') + }, + resetDefaults({ commit }) { commit('RESET_DEFAULTS') localStore.set('workRounds', defaults.workRounds) From 1fdcdf6ffa72847e2ee47c6da0c3f41b9a136124 Mon Sep 17 00:00:00 2001 From: mihaiconstantin Date: Sat, 16 May 2020 15:32:06 +0200 Subject: [PATCH 2/3] Updated `checkRound` to increment `totalWorkRounds` --- src/renderer/components/timer/Timer-controller.vue | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/renderer/components/timer/Timer-controller.vue b/src/renderer/components/timer/Timer-controller.vue index 3746e40..63282c6 100644 --- a/src/renderer/components/timer/Timer-controller.vue +++ b/src/renderer/components/timer/Timer-controller.vue @@ -29,10 +29,12 @@ export default { checkRound() { if (this.currentRound === 'work' && this.round >= this.workRounds) { this.$store.dispatch('setCurrentRound', 'long-break') + this.$store.dispatch('incrementTotalWorkRounds') EventBus.$emit('ready-long-break') console.log('long-break ready') } else if (this.currentRound === 'work') { this.$store.dispatch('setCurrentRound', 'short-break') + this.$store.dispatch('incrementTotalWorkRounds') EventBus.$emit('ready-short-break') console.log('short-break ready') } else if (this.currentRound === 'short-break') { From 780e05917ce8923523978854346536c9f56b5fba Mon Sep 17 00:00:00 2001 From: mihaiconstantin Date: Sat, 16 May 2020 15:33:35 +0200 Subject: [PATCH 3/3] Added `totalWorkRounds` to the interface footer --- src/renderer/components/timer/Timer-footer.vue | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/renderer/components/timer/Timer-footer.vue b/src/renderer/components/timer/Timer-footer.vue index 8d1e0ca..4ea032f 100644 --- a/src/renderer/components/timer/Timer-footer.vue +++ b/src/renderer/components/timer/Timer-footer.vue @@ -1,7 +1,7 @@