From 474668b2bb64a7961e01e455f367187b432187e3 Mon Sep 17 00:00:00 2001 From: J0shuaLeong Date: Mon, 13 Nov 2023 23:22:03 +0800 Subject: [PATCH 1/4] Update DG --- docs/DeveloperGuide.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/DeveloperGuide.md b/docs/DeveloperGuide.md index c5740b3996..6eede1c544 100644 --- a/docs/DeveloperGuide.md +++ b/docs/DeveloperGuide.md @@ -419,6 +419,7 @@ BMI, ideal weight for their height and so on. ## User Stories --- + | Version | As a ... | I want to ... | So that I can ... | |---------|----------|---------------------------------------------------------------------------------------------------|--------------------------------------------------------------| | v1.0 | new user | know how to use the product | use the product | From e0f8189293e0729c54e618261868c4dc973a4564 Mon Sep 17 00:00:00 2001 From: J0shuaLeong Date: Mon, 13 Nov 2023 23:22:21 +0800 Subject: [PATCH 2/4] Remove Unused Storage test --- .../java/fittrack/storage/StorageTest.java | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/src/test/java/fittrack/storage/StorageTest.java b/src/test/java/fittrack/storage/StorageTest.java index ece54be86c..2f22ccf41a 100644 --- a/src/test/java/fittrack/storage/StorageTest.java +++ b/src/test/java/fittrack/storage/StorageTest.java @@ -7,23 +7,12 @@ public class StorageTest { - private static final String TEST_DATA_FOLDER = "test/data/StorageTest"; - @Test public void constructor_nullFilePath_exceptionThrown() { assertThrows(NullPointerException.class, () -> new Storage(null, null, null, null)); } - //TODO fix test - /*@Test - public void load_invalidProfileFormat_exceptionThrown() throws Exception { - // The file contains valid txt data, but does not match the format - Storage storage = getStorage("InvalidProfileData.txt", - "InvalidMealListData.txt", "InvalidWorkoutListData.txt", "InvalidStepListData.txt"); - assertThrows(Ui.ForceExitException.class, () -> storage.loadProfile()); - }*/ - @Test public void save_nullAddressBook_exceptionThrown() { Storage storage = new Storage(); @@ -31,12 +20,4 @@ public void save_nullAddressBook_exceptionThrown() { assertThrows(AssertionError.class, () -> storage.saveMeals(null)); assertThrows(AssertionError.class, () -> storage.saveWorkouts(null)); } - - private Storage getStorage(String profileFileName, String mealFileName, String workoutFileName, String stepFileName) - throws Exception { - return new Storage(TEST_DATA_FOLDER + "/" + profileFileName, - TEST_DATA_FOLDER + "/" + mealFileName, - TEST_DATA_FOLDER + "/" + workoutFileName, - TEST_DATA_FOLDER + "/" + stepFileName); - } } From 2a11ea1d4febb48d60887cdeb79c65a18f0ad16a Mon Sep 17 00:00:00 2001 From: J0shuaLeong Date: Mon, 13 Nov 2023 23:23:51 +0800 Subject: [PATCH 3/4] All possible inputs Resolves #60 --- text-ui-test/EXPECTED.TXT | 128 +++++++++++++++++++++++++++++++++++--- text-ui-test/input.txt | 29 ++++++++- 2 files changed, 148 insertions(+), 9 deletions(-) diff --git a/text-ui-test/EXPECTED.TXT b/text-ui-test/EXPECTED.TXT index a26be7c4ac..a05ca7d939 100644 --- a/text-ui-test/EXPECTED.TXT +++ b/text-ui-test/EXPECTED.TXT @@ -76,6 +76,10 @@ ____________________________________________________________ `editprofile` allows you to edit your profile. Type `editprofile h/ w/ g/ l/` to edit. ____________________________________________________________ +`editprofile h/180 w/70 g/K l/1000` is an invalid command. Gender must be either M or F. +`editprofile` allows you to edit your profile. +Type `editprofile h/ w/ g/ l/` to edit. +____________________________________________________________ Your Profile: Height: 170.0cm Weight: 70.0kg @@ -108,6 +112,18 @@ Type `addmeal c/` to add today's meal. Type `addmeal c/ d/` to add a meal. You should type in format of `yyyy-MM-dd`. ____________________________________________________________ +`addmeal rice c/-100` is an invalid command. Calories must not be a negative value. +`addmeal` adds your daily meal data to the list. +Type `addmeal c/` to add today's meal. +Type `addmeal c/ d/` to add a meal. +You should type in format of `yyyy-MM-dd`. +____________________________________________________________ +`addmeal rice c/100 d/11-11-2023` is an invalid command. The date format is not valid. +`addmeal` adds your daily meal data to the list. +Type `addmeal c/` to add today's meal. +Type `addmeal c/ d/` to add a meal. +You should type in format of `yyyy-MM-dd`. +____________________________________________________________ `viewmeal qw` is an invalid command. The input pattern is not valid. `viewmeal` shows the list of all meals. Type `viewmeal` to view the list of meals. @@ -122,6 +138,24 @@ Type `addworkout c/` to add today's workout. Type `addworkout c/ d/` to add a workout. You should type in format of `yyyy-MM-dd`. ____________________________________________________________ +`addworkout run c/-100 d/2023-10-22` is an invalid command. Calories must not be a negative value. +`addworkout` adds your daily workout data to the list. +Type `addworkout c/` to add today's workout. +Type `addworkout c/ d/` to add a workout. +You should type in format of `yyyy-MM-dd`. +____________________________________________________________ +`addworkout run c/100 d/11-11-2023` is an invalid command. The date format is not valid. +`addworkout` adds your daily workout data to the list. +Type `addworkout c/` to add today's workout. +Type `addworkout c/ d/` to add a workout. +You should type in format of `yyyy-MM-dd`. +____________________________________________________________ +`addworkout run c/100 d/100-100-2023` is an invalid command. The date format is not valid. +`addworkout` adds your daily workout data to the list. +Type `addworkout c/` to add today's workout. +Type `addworkout c/ d/` to add a workout. +You should type in format of `yyyy-MM-dd`. +____________________________________________________________ I've added the following workout: [W] run (100kcal, 2023-10-22) ____________________________________________________________ @@ -161,6 +195,11 @@ ____________________________________________________________ Type `caloriesburnt ` to see the total calories burnt on that date. You should type in format of `yyyy-MM-dd`. ____________________________________________________________ +`caloriesburnt 11-11-2023` is an invalid command. The date format is not valid. +`caloriesburnt` shows your total calories burnt on a specific date. +Type `caloriesburnt ` to see the total calories burnt on that date. +You should type in format of `yyyy-MM-dd`. +____________________________________________________________ [W] long run (200kcal, 2023-10-29) Total calories burnt on 2023-10-29: 200kcal ____________________________________________________________ @@ -169,25 +208,43 @@ ____________________________________________________________ Type `caloriesconsumed ` to see the total calories consumed on that date. You should type in format of `yyyy-MM-dd`. ____________________________________________________________ +`caloriesconsumed 11-11-2023` is an invalid command. The date format is not valid. +`caloriesconsumed` shows your total calories consumed on a specific date. +Type `caloriesconsumed ` to see the total calories consumed on that date. +You should type in format of `yyyy-MM-dd`. +____________________________________________________________ [M] cabonara pasta (180kcal, 2023-10-29) Total calories consumed on 2023-10-29: 180kcal ____________________________________________________________ +`caloriebalance 11-11-2023` is an invalid command. The date format is not valid. +caloriebalance will take your calorie limit you set and will calculate your current calorie balance for the day using the calories you burnt during workoutsand the calories you consumed during meals +Type caloriebalance to see today's calorie balance. +You should type in format of yyyy-MM-dd. +____________________________________________________________ +Your calorie balance on 2023-11-11 is: 1500.0kcal +You are in a calorie deficit! +You can try to eat more! +____________________________________________________________ `deletemeal1` is an invalid command. Type `help` or `help ` to view help. ____________________________________________________________ I've deleted the following meal: [M] pasta (200kcal, 2023-10-22) ____________________________________________________________ +`deletemeal 4` is an invalid command. Index out of range. Index must be in the range of 1 and the list size! +`deletemeal` deletes your daily meal data from the list. +Type `deletemeal ` to delete the meal by an index. +____________________________________________________________ `deleteworkout1` is an invalid command. Type `help` or `help ` to view help. ____________________________________________________________ +`deleteworkout 4` is an invalid command. Index out of range. Index must be in the range of 1 and the list size! +`deleteworkout` deletes your daily workout data from the list. +Type `deleteworkout ` to delete the workout by an index. +____________________________________________________________ I've deleted the following workout: [W] run (100kcal, 2023-10-22) ____________________________________________________________ -`checkrecommendedweight 1` is an invalid command. The input pattern is not valid. -`checkrecommendedweight` calculates the recommended weight for your height. -Type `checkrecommendedweight` calculate the recommended weight for your height. -____________________________________________________________ Recommended Weight: 66.02 kg ____________________________________________________________ `addsteps 2000 d/` is an invalid command. The input pattern is not valid. @@ -196,6 +253,18 @@ Type `addsteps ` to add today's steps walked. Type `addsteps d/` to add an entry of the steps walked on that date. You should type in format of `yyyy-MM-dd`. ____________________________________________________________ +`addsteps -2000 d/2023-11-11` is an invalid command. Steps must be a positive integer. +`addsteps` adds your step data to the list. +Type `addsteps ` to add today's steps walked. +Type `addsteps d/` to add an entry of the steps walked on that date. +You should type in format of `yyyy-MM-dd`. +____________________________________________________________ +`addsteps 2000 d/11-11-2023` is an invalid command. The date format is not valid. +`addsteps` adds your step data to the list. +Type `addsteps ` to add today's steps walked. +Type `addsteps d/` to add an entry of the steps walked on that date. +You should type in format of `yyyy-MM-dd`. +____________________________________________________________ `addsteps` is an invalid command. The input pattern is not valid. `addsteps` adds your step data to the list. Type `addsteps ` to add today's steps walked. @@ -232,17 +301,38 @@ Type `addsteps ` to add today's steps walked. Type `addsteps d/` to add an entry of the steps walked on that date. You should type in format of `yyyy-MM-dd`. ____________________________________________________________ -These are the steps you have done: -1.[S] 2000 steps (2023-11-11) +I've added the following steps: +[S] 1000 steps (2023-11-11) ____________________________________________________________ These are the steps you have done: 1.[S] 2000 steps (2023-11-11) +2.[S] 1000 steps (2023-11-11) +____________________________________________________________ +Total steps taken: 0 steps ____________________________________________________________ -`deletesteps 2` is an invalid command. Index out of range. Index must be in the range of 1 and the list size! +`totalsteps 11-11-2023` is an invalid command. The date format is not valid. +`totalsteps` shows the total number of steps taken on a specific date. +Type `totalsteps` to show the total number of steps walked on that date. +.You should type in format of `yyyy-MM-dd`. +____________________________________________________________ +Total steps taken: 3000 steps +____________________________________________________________ +`getstepssuggestion 11-11-2023` is an invalid command. The date format is not valid. +`getstepssuggestion` checks if you are meeting your daily calorie goals through the number of steps walked. +Type `getstepssuggestion` to check if you have met your daily calorie goals through the steps walked. +Type `getstepssuggestion ` to check. +You should type in format of `yyyy-MM-dd`. +____________________________________________________________ +You have not exceeded your daily calorie limit. You should walk 34500.0 more steps. +____________________________________________________________ +`deletesteps 4` is an invalid command. Index out of range. Index must be in the range of 1 and the list size! `deletesteps` deletes your steps entry from the list. Type `deletesteps ` to delete the step entry by a index. ____________________________________________________________ I've deleted the following step entry: +[S] 1000 steps (2023-11-11) +____________________________________________________________ +I've deleted the following step entry: [S] 2000 steps (2023-11-11) ____________________________________________________________ These are the steps you have done: @@ -299,12 +389,36 @@ ____________________________________________________________ Type `caloriesconsumed ` to see the total calories consumed on that date. You should type in format of `yyyy-MM-dd`. ____________________________________________________________ +caloriebalance will take your calorie limit you set and will calculate your current calorie balance for the day using the calories you burnt during workoutsand the calories you consumed during meals +Type caloriebalance to see today's calorie balance. +You should type in format of yyyy-MM-dd. +____________________________________________________________ `findmeal` finds the meal you are looking for in your meal list. Type `findmeal ` to find a meal. ____________________________________________________________ `findworkout` finds the workout you are looking for in your workout list. Type `findworkout ` to find a workout. ____________________________________________________________ +`addsteps` adds your step data to the list. +Type `addsteps ` to add today's steps walked. +Type `addsteps d/` to add an entry of the steps walked on that date. +You should type in format of `yyyy-MM-dd`. +____________________________________________________________ +`deletesteps` deletes your steps entry from the list. +Type `deletesteps ` to delete the step entry by a index. +____________________________________________________________ +`viewsteps` shows the list of all steps. +Type `viewsteps` to view the list of your steps. +____________________________________________________________ +`totalsteps` shows the total number of steps taken on a specific date. +Type `totalsteps` to show the total number of steps walked on that date. +.You should type in format of `yyyy-MM-dd`. +____________________________________________________________ +`getstepssuggestion` checks if you are meeting your daily calorie goals through the number of steps walked. +Type `getstepssuggestion` to check if you have met your daily calorie goals through the steps walked. +Type `getstepssuggestion ` to check. +You should type in format of `yyyy-MM-dd`. +____________________________________________________________ `` is an invalid command. Type `help` or `help ` to view help. ____________________________________________________________ diff --git a/text-ui-test/input.txt b/text-ui-test/input.txt index aa51a9de43..e006e86949 100644 --- a/text-ui-test/input.txt +++ b/text-ui-test/input.txt @@ -12,6 +12,7 @@ viewprofile editprofile h/170 w/70 g/M l/1500 editprofileh/120w/80g/Ml/100 editprofile h/-180 w/70 g/K l/1000 +editprofile h/180 w/70 g/K l/1000 viewprofile bmi bmi 30f @@ -19,9 +20,14 @@ addmeal pasta c/200 d/2023-10-22 addmeal pizza 200 addmeal cabonara pasta c/180 d/2023-10-29 addmeal pizza c/230 d/2023-11-1 +addmeal rice c/-100 +addmeal rice c/100 d/11-11-2023 viewmeal qw viewmeal addworkout run 400 d/2023-10-22 +addworkout run c/-100 d/2023-10-22 +addworkout run c/100 d/11-11-2023 +addworkout run c/100 d/100-100-2023 addworkout run c/100 d/2023-10-22 addworkout long run c/200 d/2023-10-29 addworkout sprint run c/100 d/2023-11-1 @@ -31,16 +37,23 @@ findworkout findmeal pasta findworkout run caloriesburnt +caloriesburnt 11-11-2023 caloriesburnt 2023-10-29 caloriesconsumed +caloriesconsumed 11-11-2023 caloriesconsumed 2023-10-29 +caloriebalance 11-11-2023 +caloriebalance 2023-11-11 deletemeal1 deletemeal 1 +deletemeal 4 deleteworkout1 +deleteworkout 4 deleteworkout 1 -checkrecommendedweight 1 checkrecommendedweight addsteps 2000 d/ +addsteps -2000 d/2023-11-11 +addsteps 2000 d/11-11-2023 addsteps addsteps2000d/2023-11-11 addsteps 200 d/2023-11 @@ -48,8 +61,14 @@ addsteps 2000 2023-11-11 addsteps d/2023-11-11 addsteps 2000 d/2023-11-11 addsteps d/ +addsteps 1000 d/2023-11-11 viewsteps -viewsteps +totalsteps 2023-10-10 +totalsteps 11-11-2023 +totalsteps 2023-11-11 +getstepssuggestion 11-11-2023 +getstepssuggestion 2023-11-11 +deletesteps 4 deletesteps 2 deletesteps 1 viewsteps @@ -66,8 +85,14 @@ help deleteworkout help checkrecommendedweight help caloriesburnt help caloriesconsumed +help caloriebalance help findmeal help findworkout +help addsteps +help deletesteps +help viewsteps +help totalsteps +help getstepssuggestion foo foo From 894363ac1e83420ad288e3134417fe68a03b717e Mon Sep 17 00:00:00 2001 From: J0shuaLeong Date: Mon, 13 Nov 2023 23:31:36 +0800 Subject: [PATCH 4/4] Update UG --- docs/UserGuide.md | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/docs/UserGuide.md b/docs/UserGuide.md index 96feaf1e0e..1643488d63 100644 --- a/docs/UserGuide.md +++ b/docs/UserGuide.md @@ -508,19 +508,17 @@ Goodbye! Hope to see you again soon! Upon exiting the application, there should be three files in the data folder will that contains the profile data, meals and workouts as shown below. - +![](images/DataDirectory.png) The contents of profile.txt: - +![](images/ProfileFile.png) The contents of mealList.txt: - - +![](images/MealFile.png) The contents of workoutList.txt: - - +![](images/WorkoutFile.png)