Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add sequence diagrams #274

Merged
merged 6 commits into from
Nov 13, 2023
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
7 changes: 4 additions & 3 deletions docs/DeveloperGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -366,10 +366,11 @@ The steps command will specifically interact with the `stepList` in the supercla
- `getstepssuggestions` will calculate the calories burnt based on the steps taken and the user's weight. It
will then suggest how many more steps they need to take to meet their daily calorie goal.

The diagram below shows the class diagram to show the inheritance from the `Command` superclass:
![Step command class diagram](images/AddStepsCommand.png "Step command class diagram")
The below sequence diagram shows the sequence of the `addsteps` command:
![Sequence of adding steps](images/AddStepCommand-0.png)

The structure is very similar to the other commands albeit for a few attributes and the logic is implemented in the `execute()` method.
...and `deletesteps` command.
![Sequence of deleting steps](images/DeleteStepsCommand-0.png)

### 8. Handling an Invalid Input
If user enters invalid input, the app uses `InvalidCommand` class to handle it.
Expand Down
35 changes: 35 additions & 0 deletions docs/diagrams/AddStepCommand.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
@startuml

!include style.puml

box Logic LOGIC_COLOR_T1
participant ":LogicManager" as LogicManager LOGIC_COLOR
participant ":CommandParser" as CommandParser LOGIC_COLOR
participant ":AddStepsCommand" as AddStepsCommand LOGIC_COLOR
participant ":CommandResult" as CommandResult LOGIC_COLOR
end box

box Model MODEL_COLOR_T1
participant ":StepList" as StepList MODEL_COLOR
end box

-> LogicManager ++: execute ("addsteps 200 d/2023-10-10")
LogicManager -> CommandParser ++: parseCommand("addsteps 200 d/2023-10-10")
create AddStepsCommand
CommandParser -> AddStepsCommand ++:
return
CommandParser -> AddStepsCommand ++: setArguments("200", userCommandLine:String)
return command:Command
return command:Command
LogicManager -> LogicManager ++: executeCommand()
LogicManager -> AddStepsCommand ++: execute()
AddStepsCommand -> StepList ++: addSteps(1)
return
create CommandResult
AddStepsCommand -> CommandResult ++:
return result
return result
return result
return

@enduml
35 changes: 35 additions & 0 deletions docs/diagrams/DeleteStepsCommand.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
@startuml

!include style.puml

box Logic LOGIC_COLOR_T1
participant ":LogicManager" as LogicManager LOGIC_COLOR
participant ":CommandParser" as CommandParser LOGIC_COLOR
participant ":DeleteStepsCommand" as DeleteStepsCommand LOGIC_COLOR
participant ":CommandResult" as CommandResult LOGIC_COLOR
end box

box Model MODEL_COLOR_T1
participant ":StepList" as StepList MODEL_COLOR
end box

-> LogicManager ++: execute ("deletesteps 1")
LogicManager -> CommandParser ++: parseCommand("deletesteps 1")
create DeleteStepsCommand
CommandParser -> DeleteStepsCommand ++:
return
CommandParser -> DeleteStepsCommand ++: setArguments("1", userCommandLine:String)
return command:Command
return command:Command
LogicManager -> LogicManager ++: executeCommand()
LogicManager -> DeleteStepsCommand ++: execute()
DeleteStepsCommand -> StepList ++: deleteSteps(1)
return
create CommandResult
DeleteStepsCommand -> CommandResult ++:
return result
return result
return result
return

@enduml
Binary file added docs/images/AddStepCommand-0.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 removed docs/images/AddStepsCommand.png
Binary file not shown.
Binary file added docs/images/DeleteStepsCommand-0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 13 additions & 7 deletions docs/team/farissirraj.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,36 +6,41 @@
#### Key Contributions


* **Feature 1:** Steps Class
* **Steps Class**
- Wrote the class for `Step` which was used to store the steps taken by the user as an object.
- Wrote the methods to enable parsing, formatting and other operations required within the object.
- Added on to the Parser and Storage classes to integrate this feature with the existing functionality of the codebase.


* **Feature 2:** Add and Delete steps
* **Add and Delete steps**
- What it does: allows user to add in their steps and view their steps for the day.
- Calculate the number of steps taken in a particular day.
- Delete steps that were added by mistake.
- Justification: this feature helps user to track their steps and compare it with their daily goals.


* **Feature 3:** List Steps
* **List Steps**
- What it does: allows user to view the steps in a list.
- Delete steps that were added by mistake.
- Justification: Enables the user to better decide on what operation they want to do. For example, deleting a step uses the index in the list as a reference and viewing the list of steps will allow them to carefully select which entry to delete.


* **Feature 4:** Calculate the calories consumed
* **Calculate the calories consumed**
- What it does: Calculate the calories consumed based on the meals eaten.
- Justification: Allows the user to keep track of their fitness goals through the calories consumed from meals.


* **Feature 5:** Provide suggestions on how many more steps need to be walked to reach the daily calorie goal.
* **Calculate the total number of steps walked**
- What it does: Calculate the total number of steps walked in a given day.
- Justification: Allows the user to keep track of their daily step count. This will allow the user to analyse their walking habits just as they do for their meals and workouts.


* **Provide suggestions on how many more steps need to be walked to reach the daily calorie goal.**
- What it does: Calculate the calories consumed based on the number of steps walked.
- Justification: Allows the user to keep track of their calorie expenses through walking alone.


* **Feature 6:** Provide a suggestion on the ideal weight range for the user.
* **Provide a suggestion on the ideal weight range for the user.**
- What it does: Calculates the ideal weight range for the user provided their height as entered in the user profile.
- Justification: Allows the user to be mindful of their weight as they are on the journey to becoming fit.

Expand Down Expand Up @@ -65,4 +70,5 @@
- Added documentation for the features `addsteps`, `deletesteps`, `viewsteps`, `caloriesconsumed`, `getstepssuggestion`, `totalsteps` and `checkrecommendedweight` to allow the new user to start using this project.
- Developer Guide:
- Documented my added features to the developer guide.
- Added documentation for the commands pertaining to the `Step` suite of commands which all inherit from the Command superclass to explain the functionality of the commands to another developer.
- Added documentation for the commands pertaining to the `Step` suite of commands which all inherit from the Command superclass to explain the functionality of the commands to another developer.
- Added sequence diagrams for some of the commands to explain the flow of the code.
Loading