Skip to content

Commit

Permalink
Merge b948552 into 6f65c70
Browse files Browse the repository at this point in the history
  • Loading branch information
jietung committed Nov 7, 2019
2 parents 6f65c70 + b948552 commit 0baeeda
Show file tree
Hide file tree
Showing 40 changed files with 204 additions and 125 deletions.
3 changes: 3 additions & 0 deletions docs/DeveloperGuide.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -612,6 +612,7 @@ all in one place as it stores the tags, and creates the predicate and filters th
*** Increases the complexity of the code as more classes are needed, also increasing the lines of code written.
// end::suggest[]

// tag::statistic[]
=== Statistics

==== Implementation
Expand Down Expand Up @@ -650,6 +651,8 @@ Shown below is the sequence diagram (Figure 26) when user enters a valid `stats`
.Sequence diagram of a `stats` command
image::StatisticSequenceDiagram.png[]

// end::statistic[]

=== Logging

We are using `java.util.logging` package for logging. The `LogsCenter` class is used to manage the logging levels and logging destinations.
Expand Down
55 changes: 47 additions & 8 deletions docs/UserGuide.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ You can enter the following additional information for each exercise:
Format: `add t/exercise n/EXERCISE_NAME d/DATE c/CALORIES q/QUANTITY u/UNITS [m/MUSCLE]...`

****
* Calories entered have to be less than or equal to 50000.
* Dates that are entered have to be of the form `dd/MM/yyyy`.
* The day of each date must be between 01 and 31 inclusive.
* The month of each date must be between 01 and 12 inclusive.
Expand Down Expand Up @@ -122,10 +123,22 @@ Example:

Adds the 1st, 2nd and 3rd exercise in the list to the regime named `power sets`.

Expected result:

image::AddNewRegime.png[]

* `add t/regime n/cardio i/4`

Adds the 4th exercise in the list to the regime named `cardio`.

Figure below shows regime list with regime named `cardio`:

image::RegimeCardioBefore.png[]

Expected result after `add t/regime n/cardio i/4` command executed:

image::RegimeCardioAfter.png[]

[[list]]
=== Listing information : `list`

Expand Down Expand Up @@ -221,7 +234,7 @@ Examples:

Deletes exercises from a certain scheduling regime.

Format: `delete t/exercise n/REGIME_NAME [i/INDEX]...`
Format: `delete t/regime n/REGIME_NAME [i/INDEX]...`

****
* Deletes the exercise at the specified `INDEX`.
Expand All @@ -234,17 +247,36 @@ Examples:

* `delete t/regime n/cardio i/2` +
Deletes the exercise indexed 2 in the cardio regime

Figure below shows regime list with regime named `cardio` with 4 exercises:

image::RegimeCardioAfter.png[]

Expected result after `delete t/regime n/cardio i/2` command executed:

image::DeleteExerciseFromRegime.png[]

* `delete t/regime n/legs` +
Deletes the entire regime named legs

Figure below shows regime list with regime named `legs`:

image::DeleteEntireRegimeBefore.png[]

Expected result after `delete t/regime n/legs` command executed:

image::DeleteEntireRegimeAfter.png[]

=== Clearing all entries : `clear`

Clears all entries from the exercise tracker. +
Format: `clear`

// tag::statistic[]

=== Display statistics : `stats`

Display the statistics of exercises.
Display the statistics of exercises in completed exercise list.

Format: `stats t/CAT_NAME h/CHART_TYPE [s/START_DATE] [e/END_DATE]`

Expand All @@ -257,19 +289,26 @@ Format: `stats t/CAT_NAME h/CHART_TYPE [s/START_DATE] [e/END_DATE]`
* Only exercise with same name and unit will be counted as same exercise.
* Exercise will appear as `NAME (UNIT)` in the charts. E.g `Running (km)`. If it is too long (more than 18 characters), it will be formatted to first 10 characters plus last 8 characters.
** For example, exercise `Strength Training (counts)` is more than 18 characters, it will be formatted to `Strength T...(counts)`.
* It also includes total and average `CATEGORY` per day of exercises in the date range.
* Total and average `CATEGORY` per day of exercises in the date range is shown below the chart.
****

Figure below shows an example of pie chart. +

image::PieChart.png[width="790"]
NOTE: Due to space constraint, some labels may not appear. Labels can be seen when mouse cursor hovers over the pie chart.
NOTE: Due to space constraint, some labels may not appear. Labels can be seen when mouse cursor hovers over the chart.

Example:

* `stats t/exercise h/piechart`

image::PieChart.png[width="500"]

* `stats t/calories h/linechart`
* `stats t/exercise h/barchart s/20/09/2019 e/27/09/2019`

image::LineChart.png[width="500"]

* `stats t/calories h/barchart s/31/10/2019 e/06/11/2019`

image::BarChart.png[width="500"]

// end::statistic[]

=== Undo previous command: `undo`

Expand Down
2 changes: 1 addition & 1 deletion docs/diagrams/StatisticClassDiagram.puml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class Statistic {
-Date startDate
-Date endDate
-ArrayList<String> properties
-ArrayList<Double> values
-ArrayList<Integer> values
-double total
-double average
+resetData() : void
Expand Down
Binary file added docs/images/AddNewRegime.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/BarChart.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/DeleteEntireRegimeAfter.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/DeleteEntireRegimeBefore.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/DeleteExerciseFromRegime.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/LineChart.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/RegimeCardioAfter.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/RegimeCardioBefore.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/images/StatisticClassDiagram.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
62 changes: 27 additions & 35 deletions docs/team/jietung.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -5,45 +5,42 @@

== PROJECT: ExerHealth

---

== Overview

ExerHealth is a desktop application used for tracking and scheduling the user's exercises.
The user interacts with it using a CLI, and it has a GUI created with JavaFX.
It is written in Java, and has about 10 kLoC.
My team of 5 computer science students were tasked with enhancing a basic command line interface desktop Addressbook3
application for software engineering project. Our team decided to morph the application to ExerHealth. ExerHealth is
a desktop application used for tracking and scheduling the user's exercises. The application has statistical analysis of
exercises user have completed in the past. Additionally, it also acts as a personal trainer by suggesting different
exercises which both beginners and advanced users can choose from to incorporate into their exercise regime. The user
interacts with it using a command line interface, and it has a GUI created with JavaFX.

Figure below is a screenshot of what our application looks like:
//TODO: Add image of UI

Figure 1. The graphical user interface for ExerHealth

My role was to develop the add and delete regime feature and statistic feature. The following sections illustrates these
enhancements in more details, as well as the relevant documentation I have added to the user and developer guides in
relation to those enhancements.

== Summary of contributions
This section shows a summary of my coding, documentation and other helpful contributions to the team project.

* *Major enhancement*: added *the ability to undo/redo previous commands*
** What it does: allows the user to undo all previous commands one at a time. Preceding undo commands can be reversed by using the redo command.
** Justification: This feature improves the product significantly because a user can make mistakes in commands and the app should provide a convenient way to rectify them.
** Highlights: This enhancement affects existing commands and commands to be added in future. It required an in-depth analysis of design alternatives. The implementation too was challenging as it required changes to existing commands.
** Credits: _{mention here if you reused any code/ideas from elsewhere or if a third-party library is heavily used in the feature so that a reader can make a more accurate judgement of how much effort went into the feature}_
* *Major enhancement*: Added the ability to display statistic and charts which includes pie chart, line chart and bar chart.
** What it does: The `stats` command will allow users to display chart and statistic of the exercise they have completed.
** Justification: This feature will enable users to have an overview of number of exercise they have completed and calories they have burnt. This will help users understand their progress and improve planning of exercises in the future.
** Highlights: This enhancement works well with existing commands and commands to be added in future. It required an in-depth analysis of design alternatives to ensure that future enhancements can be made.

* *Minor enhancement*: added a history command that allows the user to navigate to previous commands using up/down keys.
* *Minor enhancement 1*: Added a `Unit` property to exercise.
* *Minor enhancement 2*: Added add and delete regime command that allows the user to add and delete regime from regime list.

* *Code contributed*: [https://github.com[Functional code]] [https://github.com[Test code]] _{give links to collated code files}_
* *Code contributed*: [https://nus-cs2103-ay1920s1.github.io/tp-dashboard/#search=jietung&sort=groupTitle&sortWithin=title&since=2019-09-06&timeframe=commit&mergegroup=false&groupSelect=groupByRepos&breakdown=false[RepoSense]]

* *Other contributions*:

** Project management:
*** Managed releases `v1.3` - `v1.5rc` (3 releases) on GitHub
** Enhancements to existing features:
*** Updated the GUI color scheme (Pull requests https://github.com[#33], https://github.com[#34])
*** Wrote additional tests for existing features to increase coverage from 88% to 92% (Pull requests https://github.com[#36], https://github.com[#38])
** Documentation:
*** Did cosmetic tweaks to existing contents of the User Guide: https://github.com[#14]
** Community:
*** PRs reviewed (with non-trivial review comments): https://github.com[#12], https://github.com[#32], https://github.com[#19], https://github.com[#42]
*** Contributed to forum discussions (examples: https://github.com[1], https://github.com[2], https://github.com[3], https://github.com[4])
*** Reported bugs and suggestions for other teams in the class (examples: https://github.com[1], https://github.com[2], https://github.com[3])
*** Some parts of the history feature I added was adopted by several other class mates (https://github.com[1], https://github.com[2])
** Tools:
*** Integrated a third party library (Natty) to the project (https://github.com[#42])
*** Integrated a new Github plugin (CircleCI) to the team repo

_{you can add/remove categories in the list above}_
*** Refactored Addressbook3 codebase to ExerHealth (Pull request https://github.com/AY1920S1-CS2103T-T09-2/main/pull/81[#81])
*** Wrote additional tests for existing and new features to increase coverage (Pull requests https://github.com/AY1920S1-CS2103T-T09-2/main/pull/125[#125], https://github.com/AY1920S1-CS2103T-T09-2/main/pull/127[#127])

== Contributions to the User Guide

Expand All @@ -52,20 +49,15 @@ _{you can add/remove categories in the list above}_
|_Given below are sections I contributed to the User Guide. They showcase my ability to write documentation targeting end-users._
|===

include::../UserGuide.adoc[tag=delete]

include::../UserGuide.adoc[tag=dataencryption]
include::../UserGuide.adoc[tag=statistic]

== Contributions to the Developer Guide

|===
|_Given below are sections I contributed to the Developer Guide. They showcase my ability to write technical documentation and the technical depth of my contributions to the project._
|===

include::../DeveloperGuide.adoc[tag=undoredo]

include::../DeveloperGuide.adoc[tag=dataencryption]

include::../DeveloperGuide.adoc[tag=statistic]

== PROJECT: PowerPointLabs

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/seedu/exercise/commons/core/Messages.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
public class Messages {

public static final String MESSAGE_UNKNOWN_COMMAND = "Unknown command";
public static final String MESSAGE_INVALID_COMMAND_FORMAT = "Invalid command format! \n%1$s";
public static final String MESSAGE_INVALID_COMMAND_FORMAT = "Invalid command format! \t%1$s";
public static final String MESSAGE_INVALID_EXERCISE_DISPLAYED_INDEX = "The exercise index provided is invalid";
public static final String MESSAGE_INVALID_REGIME_DISPLAYED_INDEX = "The regime index provided is invalid";
public static final String MESSAGE_INVALID_SCHEDULE_DISPLAYED_INDEX = "The schedule index provided is invalid";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Encapsulates the different validation regex that help to check if an input is correct.
*/
public class ValidationRegex {

public static final String ONLY_INTEGER = "\\d+";
public static final String ONLY_NUMBERS = "\\d+(\\.\\d+)?";
public static final String ONLY_ALPHABETS_AND_SPACE = "^[ A-Za-z]+$";
public static final String ONLY_ALPHABETS = "^[A-Za-z]+$";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ public class AddExerciseCommand extends AddCommand implements PayloadCarrierComm
+ PREFIX_CALORIES + "CALORIES "
+ PREFIX_QUANTITY + "QUANTITY "
+ PREFIX_UNIT + "UNITS "
+ "[" + PREFIX_MUSCLE + "MUSCLE]...\n"
+ "\t\tExample: " + COMMAND_WORD + " "
+ "[" + PREFIX_MUSCLE + "MUSCLE]..."
+ "\tExample: " + COMMAND_WORD + " "
+ PREFIX_CATEGORY + "exercise "
+ PREFIX_NAME + "Run "
+ PREFIX_DATE + "22/09/2019 "
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import seedu.exercise.model.resource.Regime;
import seedu.exercise.ui.ListResourceType;

//@@author jietung
/**
* Adds a regime to the regime book.
*/
Expand All @@ -34,8 +35,8 @@ public class AddRegimeCommand extends AddCommand implements PayloadCarrierComman
public static final String MESSAGE_USAGE_REGIME = "Parameters: "
+ PREFIX_CATEGORY + "CATEGORY "
+ PREFIX_NAME + "REGIME NAME "
+ PREFIX_INDEX + "INDEX\n"
+ "\t\tExample: " + COMMAND_WORD + " "
+ PREFIX_INDEX + "INDEX"
+ "\tExample: " + COMMAND_WORD + " "
+ PREFIX_CATEGORY + "regime "
+ PREFIX_NAME + "power set "
+ PREFIX_INDEX + "1 "
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ public abstract class DeleteCommand extends Command implements UndoableCommand,
public static final String COMMAND_WORD = "delete";

public static final String MESSAGE_USAGE = COMMAND_WORD
+ ": Deletes the exercise identified by the index number used in the displayed exercise list.\n"
+ "or Deletes the regimes/exercise in regime identified by name/index in the displayed regime list\n"
+ ": Deletes the exercise identified by the index number used in the displayed exercise list "
+ "OR Deletes the regimes/exercise in regime identified by name/index in the displayed regime list\n"
+ "EXERCISE: " + MESSAGE_USAGE_EXERCISE + "\n"
+ "REGIME: " + MESSAGE_USAGE_REGIME;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
*/
public class DeleteExerciseCommand extends DeleteCommand implements PayloadCarrierCommand {

public static final String MESSAGE_USAGE_EXERCISE = "Parameters: INDEX (must be a positive integer)\n"
+ "\t\tExample: "
public static final String MESSAGE_USAGE_EXERCISE = "Parameters: INDEX (must be a positive integer)"
+ "\tExample: "
+ COMMAND_WORD + " "
+ PREFIX_CATEGORY + "exercise "
+ PREFIX_INDEX + "1";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,14 @@
import seedu.exercise.model.resource.Regime;
import seedu.exercise.ui.ListResourceType;

//@@author jietung
/**
* Deletes a regime identified using it's name or deletes exercises in regime.
*/
public class DeleteRegimeCommand extends DeleteCommand implements PayloadCarrierCommand {

public static final String MESSAGE_USAGE_REGIME = "Parameters: REGIME NAME, INDEX (must be a positive integer)\n"
+ "\t\tExample: "
public static final String MESSAGE_USAGE_REGIME = "Parameters: REGIME NAME, INDEX (must be a positive integer)"
+ "\tExample: "
+ COMMAND_WORD + " "
+ PREFIX_CATEGORY + "regime "
+ PREFIX_NAME + "level 1 "
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@ public class Statistic {
private Date startDate;
private Date endDate;
private ArrayList<String> properties;
private ArrayList<Double> values;
private ArrayList<Integer> values;
private double total;
private double average;

/**
* Every field must be present and not null.
*/
public Statistic(String category, String chart, Date startDate, Date endDate,
ArrayList<String> properties, ArrayList<Double> values, double total, double average) {
ArrayList<String> properties, ArrayList<Integer> values, double total, double average) {
requireAllNonNull(category, chart, startDate, endDate, properties, values);
this.category = category;
this.chart = chart;
Expand Down Expand Up @@ -88,7 +88,7 @@ private void setProperties(ArrayList<String> properties) {
this.properties = properties;
}

private void setValues(ArrayList<Double> values) {
private void setValues(ArrayList<Integer> values) {
requireNonNull(values);
this.values = values;
}
Expand Down Expand Up @@ -122,7 +122,7 @@ public ArrayList<String> getProperties() {
return properties;
}

public ArrayList<Double> getValues() {
public ArrayList<Integer> getValues() {
return values;
}

Expand Down
Loading

0 comments on commit 0baeeda

Please sign in to comment.