Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added docs/DeveloperGuide.pdf
Binary file not shown.
25 changes: 14 additions & 11 deletions docs/UserGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,12 @@ Here are the commands you can use:
8. add pb <exercise> /w <weight_in_kg> /d <DD/MM/YYYY> - Record a personal best
9. add cardio <exercise> /s <speed> /i <incline> /t <duration_in_min> /d <DD/MM/YYYY> - Add a cardio log
10. sum <cal|vol|cardio> /d <DD/MM/YYYY> - Sum up the total calories/water for the day
11. clear <pb|meal|workout|water> - Clear the respective log
11. clear <pb|meal|workout|water|cardio> - Clear the respective log
12. view goals - to view all goals
13 add goal /ml <waterGoals /cal <calorieGoals> /kg <weightGoals> - to edit your personal goals
14. track goal /d <DD/MM/YYYY> - to track personal goals
15. status change <cutting/bulking> - Update your cutting/bulking status
16. status report - View your current cutting/bulking progress
16. status report <DD/MM/YYY> - View your current cutting/bulking progress
17. search <logType> /d <DD/MM/YYYY> OR search <logType> /k <keyword> - Search for logs
18. list <logType> - List all logs for that specific log type
19. delete <logType> <index> - Delete specific index in the log
Expand Down Expand Up @@ -122,9 +122,9 @@ Adds a workout log with the exercise name, weight lifted, number of reps, number

Range of accepted weight: 1kg - 1000kg (takes in decimal values)

Range of accepted reps: 1 - 1000
Range of accepted reps: 1 - 1000 (takes in integer values only)

Range of accepted sets: 1 - 100
Range of accepted sets: 1 - 100 (takes in integer values only)

Format: `add workout <exercise> /w <weight in kg> /r <reps> /s <sets> /d <DD/MM/YYYY>`

Expand All @@ -138,7 +138,7 @@ Example of usage: `add workout bench /w 100 /r 8 /s 3 /d 02/02/2025`
### 6. Add meal
Adds a meal log with the meal name, calories, date, and time.

Range of accepted calories: 1 - 10000
Range of accepted calories: 1cal - 10000cal (takes in integer values only)

Format: `add meal <meal_name> /cal <calories> /d <DD/MM/YYYY> /t <HHmm>`

Expand All @@ -152,7 +152,7 @@ Example of usage: `add meal chicken rice /cal 200 /d 02/02/2025 /t 1700`
### 7. Add water
Adds a water log with the volume in ml, date, and time.

Range of accepted volume: 1ml - 10000ml
Range of accepted volume: 1ml - 10000ml (takes in integer values only)

Format: `add water /ml <volume> /d <DD/MM/YYYY> /t <HHmm>`

Expand Down Expand Up @@ -212,12 +212,13 @@ Example of usage: `sum cal /d 02/02/2025`
Total calories consumed: 500
```
The formula used to calculate calories burned from `sum cardio /d 01/01/24` is as follows:

Estimated calories burned = ((speed * 2) + (incline * 5)) * (duration / 60.0) * 100

### 11. Clear
Clear the respective log

Format: `clear <pb|meal|workout|water>`
Format: `clear <pb|meal|workout|water|cardio>`

Example of usage: `clear meal`
```
Expand Down Expand Up @@ -245,9 +246,11 @@ Able to add/edit your list of Goals, not necessary for all parameters to be inpu

Goals cannot be set as 0, cleared or deleted, only updated. This is to encourage users to set goals and stick to them.

Water goal accepted range: 1 - 10000 ml
Calorie goal accepted range: 1 - 20000 ml
Body weight goal accepted range: 1 - 700 kg
Water goal accepted range: 1 - 10000 ml (takes in integer values only)

Calorie goal accepted range: 1 - 20000 ml (takes in integer values only)

Body weight goal accepted range: 1 - 700 kg (takes in decimal values)

Format: `add goal /ml <waterGoals> | /cal <calorieGoals> | /kg <weightGoals>`

Expand Down Expand Up @@ -355,7 +358,7 @@ You can view or edit this file using any text editor.
| ```add pb``` | add pb [exercise] /w [weight_in_kg] /d [date] <br/> e.g ```add pb bench /w 120 /d 02/02/2025``` |
| ```add cardio``` | add cardio [exercise] /s [speed] /i [incline] /t [duration] /d [date] <br/> e.g ```add cardio run /s 8 /i 5 /t 30 /d 02/02/2025``` |
| ```sum``` | sum [cal/vol/cardio] /d [date] <br/> e.g ```sum cal /d 02/02/2025``` |
| ```clear``` | clear [pb\|meal\|workout\|water] <br/> e.g ```clear meal``` |
| ```clear``` | clear [pb\|meal\|workout\|water\|cardio] <br/> e.g ```clear meal``` |
| ```view goal``` | view goal <br/> e.g ```view goal``` |
| ```add goal``` | add goal /ml [waterGoals] /cal [calorieGoals] /kg [weightGoals] <br/> e.g ```add goal /ml 2000 /cal 3000 /kg 70``` |
| ```track goal``` | track goal /d [date] <br/> e.g ```track goal /d 02/02/2025``` |
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/seedu/healthbud/Ui.java
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,13 @@ public static void printHelp() {
+ "9. add cardio <exercise> /s <speed> /i <incline> /t <duration_in_min> /d <DD/MM/YYYY> "
+ "- Add a cardio log" + NEW_LINE
+ "10. sum <cal|vol|cardio> /d <DD/MM/YYYY> - Sum up the total calories/water for the day" + NEW_LINE
+ "11. clear <pb|meal|workout|water> - Clear the respective log" + NEW_LINE
+ "11. clear <pb|meal|workout|water|cardio> - Clear the respective log" + NEW_LINE
+ "12. view goals - to view all goals" + NEW_LINE
+ "13 add goal /ml <waterGoals /cal <calorieGoals> /kg <weightGoals> - to edit your personal goals"
+ NEW_LINE
+ "14. track goal /d <DD/MM/YYYY> - to track personal goals" + NEW_LINE
+ "15. status change <cutting/bulking> - Update your cutting/bulking status." + NEW_LINE
+ "16. status report - View your current cutting/bulking progress" + NEW_LINE
+ "16. status report <DD/MM/YYYY> - View your current cutting/bulking progress" + NEW_LINE
+ "17. search <logType> /d <DD/MM/YYYY> OR search <logType> /k <keyword> - Search for logs" + NEW_LINE
+ "18. list <logType> - List all logs for that specific log type" + NEW_LINE
+ "19. delete <logType> <index> - Delete specific index in the log");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,11 @@ public static AddGoalCommand parse(LogList goalLogs, String input) throws Invali

if (param.containsKey("kg")) {
String raw = param.get("kg");
int weightInt = Integer.parseInt(raw);
if (weightInt <= 0 || weightInt > 700) {
double weightDouble = Double.parseDouble(raw);
if (weightDouble <= 0 || weightDouble > 700) {
throw new HealthBudException("Weight goal must be between 1 and 700 kg.");
}
weight = String.valueOf(weightInt);
weight = String.valueOf(weightDouble);
}
return new AddGoalCommand(goalLogs, water, cal, weight);
} catch (NumberFormatException e) {
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/seedu/healthbud/storage/Storage.java
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ public static Log parseStringToGoalLog(String line) {
if (waterGoal.equals("-")) {
Goals.getInstance().setDailyWaterGoal(waterGoal);
} else if (waterGoal.matches("\\d+")) {
double water = Double.parseDouble(waterGoal);
int water = Integer.parseInt(waterGoal);
if (water < 1 || water > 10000) {
throw new IllegalArgumentException("Water goal must be between 1 and 10000");
}
Expand All @@ -424,7 +424,7 @@ public static Log parseStringToGoalLog(String line) {
if (calorieGoal.equals("-")) {
Goals.getInstance().setDailyCalorieGoal(calorieGoal);
} else if (calorieGoal.matches("\\d+")) {
double cal = Double.parseDouble(calorieGoal);
int cal = Integer.parseInt(calorieGoal);
if (cal < 1 || cal > 20000) {
throw new IllegalArgumentException("Calorie goal must be between 1 and 20000");
}
Expand All @@ -439,7 +439,7 @@ public static Log parseStringToGoalLog(String line) {
if (!weightGoal.isEmpty()) {
if (weightGoal.equals("-")) {
Goals.getInstance().setWeightGoal(weightGoal);
} else if (weightGoal.matches("\\d+")) {
} else if (weightGoal.matches("^-?\\d+(\\.\\d+)?$")) {
double weight = Double.parseDouble(weightGoal);
if (weight < 1 || weight > 700) {
throw new IllegalArgumentException("Weight goal must be between 1 and 700");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ public void addGoal_sameAsExistingGoals_expectNoPrintButStillUpdate() throws Hea

assertEquals("3000", goals.getDailyWaterGoal());
assertEquals("2500", goals.getDailyCalorieGoal());
assertEquals("80", goals.getWeightGoal());
assertEquals("80.0", goals.getWeightGoal());
}

@Test
Expand All @@ -122,7 +122,7 @@ public void addGoal_missingCalorie_expectDefaultUsed() throws HealthBudException

assertEquals("2000", goals.getDailyWaterGoal());
assertEquals("1500", goals.getDailyCalorieGoal()); // default
assertEquals("60", goals.getWeightGoal());
assertEquals("60.0", goals.getWeightGoal());
}

@Test
Expand All @@ -136,7 +136,7 @@ public void addGoal_missingWater_expectDefaultUsed() throws HealthBudException {

assertEquals("3000", goals.getDailyWaterGoal()); // default
assertEquals("1800", goals.getDailyCalorieGoal());
assertEquals("70", goals.getWeightGoal());
assertEquals("70.0", goals.getWeightGoal());
}

@Test
Expand Down Expand Up @@ -215,7 +215,7 @@ public void addGoal_eightPartsAllValid_expectSuccess() throws HealthBudException

assertEquals("2500", goals.getDailyWaterGoal());
assertEquals("2200", goals.getDailyCalorieGoal());
assertEquals("68", goals.getWeightGoal());
assertEquals("68.0", goals.getWeightGoal());
}

@Test
Expand Down