Skip to content

Commit

Permalink
Merge pull request #278 from J0shuaLeong/master
Browse files Browse the repository at this point in the history
Update UG
  • Loading branch information
J0shuaLeong authored Nov 13, 2023
2 parents dcbb555 + 894363a commit 7206485
Show file tree
Hide file tree
Showing 5 changed files with 153 additions and 34 deletions.
1 change: 1 addition & 0 deletions docs/DeveloperGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -420,6 +420,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 |
Expand Down
10 changes: 4 additions & 6 deletions docs/UserGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

<img src="./images/DataDirectory.png" width = 70% height = 70% alt="">
![](images/DataDirectory.png)

The contents of profile.txt:

<img src="./images/ProfileFile.png" width = 50% height = 50% alt="">
![](images/ProfileFile.png)

The contents of mealList.txt:

<img src="./images/MealFile.png" width = 50% height = 50% alt="">
![](images/MealFile.png)

The contents of workoutList.txt:

<img src="./images/MealFile.png" width = 50% height = 50% alt="">
![](images/WorkoutFile.png)



Expand Down
19 changes: 0 additions & 19 deletions src/test/java/fittrack/storage/StorageTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,36 +7,17 @@

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();
assertThrows(AssertionError.class, () -> storage.saveProfile(null));
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);
}
}
128 changes: 121 additions & 7 deletions text-ui-test/EXPECTED.TXT
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,10 @@ ____________________________________________________________
`editprofile` allows you to edit your profile.
Type `editprofile h/<HEIGHT> w/<WEIGHT> g/<GENDER> l/<CALORIE_LIMIT>` 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/<HEIGHT> w/<WEIGHT> g/<GENDER> l/<CALORIE_LIMIT>` to edit.
____________________________________________________________
Your Profile:
Height: 170.0cm
Weight: 70.0kg
Expand Down Expand Up @@ -108,6 +112,18 @@ Type `addmeal <MEAL_NAME> c/<CALORIES>` to add today's meal.
Type `addmeal <MEAL_NAME> c/<CALORIES> d/<DATE>` to add a meal.
You should type <DATE> 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 <MEAL_NAME> c/<CALORIES>` to add today's meal.
Type `addmeal <MEAL_NAME> c/<CALORIES> d/<DATE>` to add a meal.
You should type <DATE> 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 <MEAL_NAME> c/<CALORIES>` to add today's meal.
Type `addmeal <MEAL_NAME> c/<CALORIES> d/<DATE>` to add a meal.
You should type <DATE> 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.
Expand All @@ -122,6 +138,24 @@ Type `addworkout <WORKOUT_NAME> c/<CALORIES>` to add today's workout.
Type `addworkout <WORKOUT_NAME> c/<CALORIES> d/<DATE>` to add a workout.
You should type <DATE> 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 <WORKOUT_NAME> c/<CALORIES>` to add today's workout.
Type `addworkout <WORKOUT_NAME> c/<CALORIES> d/<DATE>` to add a workout.
You should type <DATE> 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 <WORKOUT_NAME> c/<CALORIES>` to add today's workout.
Type `addworkout <WORKOUT_NAME> c/<CALORIES> d/<DATE>` to add a workout.
You should type <DATE> 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 <WORKOUT_NAME> c/<CALORIES>` to add today's workout.
Type `addworkout <WORKOUT_NAME> c/<CALORIES> d/<DATE>` to add a workout.
You should type <DATE> in format of `yyyy-MM-dd`.
____________________________________________________________
I've added the following workout:
[W] run (100kcal, 2023-10-22)
____________________________________________________________
Expand Down Expand Up @@ -161,6 +195,11 @@ ____________________________________________________________
Type `caloriesburnt <DATE>` to see the total calories burnt on that date.
You should type <DATE> 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 <DATE>` to see the total calories burnt on that date.
You should type <DATE> in format of `yyyy-MM-dd`.
____________________________________________________________
[W] long run (200kcal, 2023-10-29)
Total calories burnt on 2023-10-29: 200kcal
____________________________________________________________
Expand All @@ -169,25 +208,43 @@ ____________________________________________________________
Type `caloriesconsumed <DATE>` to see the total calories consumed on that date.
You should type <DATE> 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 <DATE>` to see the total calories consumed on that date.
You should type <DATE> 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 <DATE> to see today's calorie balance.
You should type <DATE> 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 <COMMAND>` 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 <INDEX>` to delete the meal by an index.
____________________________________________________________
`deleteworkout1` is an invalid command.
Type `help` or `help <COMMAND>` 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 <INDEX>` 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.
Expand All @@ -196,6 +253,18 @@ Type `addsteps <NUMBER_OF_STEPS>` to add today's steps walked.
Type `addsteps <NUMBER_OF_STEPS> d/<DATE>` to add an entry of the steps walked on that date.
You should type <DATE> 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 <NUMBER_OF_STEPS>` to add today's steps walked.
Type `addsteps <NUMBER_OF_STEPS> d/<DATE>` to add an entry of the steps walked on that date.
You should type <DATE> 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 <NUMBER_OF_STEPS>` to add today's steps walked.
Type `addsteps <NUMBER_OF_STEPS> d/<DATE>` to add an entry of the steps walked on that date.
You should type <DATE> 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 <NUMBER_OF_STEPS>` to add today's steps walked.
Expand Down Expand Up @@ -232,17 +301,38 @@ Type `addsteps <NUMBER_OF_STEPS>` to add today's steps walked.
Type `addsteps <NUMBER_OF_STEPS> d/<DATE>` to add an entry of the steps walked on that date.
You should type <DATE> 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` <DATE> to show the total number of steps walked on that date.
.You should type <DATE> 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 <DATE>` to check.
You should type <DATE> 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 <INDEX>` 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:
Expand Down Expand Up @@ -299,12 +389,36 @@ ____________________________________________________________
Type `caloriesconsumed <DATE>` to see the total calories consumed on that date.
You should type <DATE> 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 <DATE> to see today's calorie balance.
You should type <DATE> in format of yyyy-MM-dd.
____________________________________________________________
`findmeal` finds the meal you are looking for in your meal list.
Type `findmeal <KEYWORD>` to find a meal.
____________________________________________________________
`findworkout` finds the workout you are looking for in your workout list.
Type `findworkout <KEYWORD>` to find a workout.
____________________________________________________________
`addsteps` adds your step data to the list.
Type `addsteps <NUMBER_OF_STEPS>` to add today's steps walked.
Type `addsteps <NUMBER_OF_STEPS> d/<DATE>` to add an entry of the steps walked on that date.
You should type <DATE> in format of `yyyy-MM-dd`.
____________________________________________________________
`deletesteps` deletes your steps entry from the list.
Type `deletesteps <INDEX>` 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` <DATE> to show the total number of steps walked on that date.
.You should type <DATE> 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 <DATE>` to check.
You should type <DATE> in format of `yyyy-MM-dd`.
____________________________________________________________
`` is an invalid command.
Type `help` or `help <COMMAND>` to view help.
____________________________________________________________
Expand Down
29 changes: 27 additions & 2 deletions text-ui-test/input.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,22 @@ 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
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
Expand All @@ -31,25 +37,38 @@ 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
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
Expand All @@ -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
Expand Down

0 comments on commit 7206485

Please sign in to comment.