diff --git a/src/stores/storeInput.js b/src/stores/storeInput.js index 90e61da..4ac88be 100644 --- a/src/stores/storeInput.js +++ b/src/stores/storeInput.js @@ -8,27 +8,19 @@ export const useWeightInputStore = defineStore('weightInput', () => { function addWorkingSet(selectedExercise) { if (!exercises.value[selectedExercise]) { - exercises.value[selectedExercise] = { - workingSet: [], - }; - exercises.value[selectedExercise].workingSet.push({ - workingSetReps: [], - workingSetWeight: [],}); + return; } exercises.value[selectedExercise].workingSet.push({ workingSetReps: [], workingSetWeight: [], }); + + console.log('Added working set:', exercises.value[selectedExercise]); } function addWarmUpSet(selectedExercise) { - if (!exercises.value[selectedExercise]) { - exercises.value[selectedExercise] = { - warmUpSet: [], - }; - exercises.value[selectedExercise].warmUpSet.push({ - warmSetReps: [], - warmSetWeight: [],}); + if (!exercises.value[selectedExercise]) { + return; } exercises.value[selectedExercise].warmUpSet.push({ warmSetReps: [], @@ -37,35 +29,37 @@ export const useWeightInputStore = defineStore('weightInput', () => { } function removeWorkingSet(selectedExercise) { - if(exercises.value[selectedExercise]) { - exercises.workingSet.pop({ - workingSetReps: [], - workingSetsWeight: [], - }) + if(!exercises.value[selectedExercise]) { + return } + exercises.value[selectedExercise].workingSet.pop({ + workingSetReps: [], + workingSetsWeight: [], + }) } function removeWarmUpSet(selectedExercise) { - if(exercises.value[selectedExercise]) { - exercises.warmUpSet.pop({ - warmUpSetReps: [], - warmUpSetsWeight: [], - }) + if(!exercises.value[selectedExercise]) { + return; } + exercises.value[selectedExercise].workingSet.pop({ + warmUpSetReps: [], + warmUpSetsWeight: [], + }) } function getWorkingSetCount(selectedExercise) { if (exercises.value[selectedExercise]) { return exercises.value[selectedExercise].workingSet.length; } - return 0; + return 1; } function getWarmUpSetCount(selectedExercise) { if (exercises.value[selectedExercise]) { return exercises.value[selectedExercise].warmUpSet.length; } - return 0; + return 1; } function initSetsInputs(selectedExercise) { @@ -74,7 +68,6 @@ export const useWeightInputStore = defineStore('weightInput', () => { workingSet: [], warmUpSet: [], }; - }; exercises.value[selectedExercise].workingSet.push({ workingSetReps: [], workingSetWeight: [], @@ -83,9 +76,18 @@ export const useWeightInputStore = defineStore('weightInput', () => { warmSetReps: [], warmSetWeight: [], }); - } + } + } - return { exercises, addWorkingSet, removeWorkingSet, addWarmUpSet, removeWarmUpSet, getWorkingSetCount, getWarmUpSetCount, initSetsInputs } + return { + exercises, + addWorkingSet, + removeWorkingSet, + addWarmUpSet, + removeWarmUpSet, + getWorkingSetCount, + getWarmUpSetCount, + initSetsInputs } } ) \ No newline at end of file diff --git a/src/views/weight/WeightsInput.vue b/src/views/weight/WeightsInput.vue index c82acf1..51f03d5 100644 --- a/src/views/weight/WeightsInput.vue +++ b/src/views/weight/WeightsInput.vue @@ -7,26 +7,24 @@ Add
-
- {{ warmUpSet }} +
+
-
-
-
- {{ workingset }} +
+
-
{ - if (weightInput.getWarmUpSetCount < 1) { - return false; - } - return true; + weightInput.getWarmUpSetCount <= 1 ? false : true; }; const workingSetSmallerOne = () => { - if (weightInput.getWorkingSetCount < 1) { - return false; - } - return true; + weightInput.getWorkingSetCount <= 1 ? false : true; }; - - - \ No newline at end of file + \ No newline at end of file