-
Notifications
You must be signed in to change notification settings - Fork 89
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
[CS2113-T17-1] AthletiCLI #16
base: master
Are you sure you want to change the base?
Changes from 250 commits
fb3eea5
e36a733
d866750
3f25007
ee3c7e5
6cb8b0c
a22144b
fb20f3a
8cf94ee
c533937
82c6ae2
ba378de
d1848d2
eb84885
4389282
8751a32
dcb1906
d16e354
c901657
f584322
4609f15
b37e982
49a59a9
e7a7ad4
aa6b4d6
ff37c62
3061e54
a4b524c
6f8b4ad
9e17afc
f4524a6
20f1489
bfe0c23
ca09b8a
6070523
db7ab28
c054e17
83453b6
e223bf2
24bb8ed
3804cf4
2ec82cf
cbc43db
36c606b
d268152
a3a5a0c
ad84c9c
fb3f4d2
67f7c29
78891e1
face75a
1abdb60
669a7a7
06aefc5
29e55d3
767b12a
b1c80c9
1a658f0
aaaab33
055f325
50587c2
26418f9
a5a2fe7
ab1603d
280ee09
27b320a
16d85a5
33e8747
4a9c0cf
8d89392
81b03bf
8224400
2a3a508
47a7f22
5128060
a00f112
d61fb7b
d0bfcff
1ac4411
e1560ed
fe6d5ec
0e9c057
a1c2e38
ab94ee8
47681d0
625b006
5f78c20
1b9162f
8e87d1e
8439deb
9ee8922
be73b39
94c4825
ad1c407
c08babe
3c9800e
139af64
ac70cd7
eb34599
e90f8a2
cd20b7b
62e2396
5cdc764
edeb2c8
f46cec1
147b527
139cdbd
6460059
8bfa0f8
b5e8fd5
4b0cc82
a553e95
6180f24
17e4d5f
f848508
9f12036
6581fb5
84fdf6a
bc91ce9
327c6a3
46dfcf5
2f2d685
107cade
79bd53c
683a975
a16e2e1
9306947
1cbae8b
4a5232d
382c6df
34fa013
d1329a6
a2c9352
4838b93
2a90bae
b6c53f7
f6debe4
299734c
c5f0b05
4403583
684f0e5
a587d74
138b673
9651fe2
cedd157
6c6f635
117ba19
0b235a3
9f3899b
68536ab
078ecef
ee48bf9
4aeb4a4
f8ec032
559b5eb
dbe68fa
7df6111
0ecb6d3
f71f603
a60df06
fbf3d18
b9bd8dc
de3b22d
292a2a0
0a1536c
0547fde
c96c62e
bb93497
7bdb151
ec15c9a
b825e54
01a160d
b26be1e
2d5d105
23d7302
b439da8
b75a951
32ab4ef
a563f18
1ec1da4
22dc7ba
f80a576
25988ac
10e71e0
049592b
8010a0b
02b362c
1312c4d
0117f83
e761a43
d3e9870
ae05125
8ff16be
f17a376
c144188
f257519
abeb5ac
50078e5
4e5b9a8
5d4e81d
a208fe3
a90b13f
82e2f68
4666a7c
433ec97
406d391
caa6bd1
69fb7da
41b371a
ddb0f43
3d0d887
be4021e
b6f091c
a8dc3fb
a73b1d0
0ba1854
e87e42f
8af64eb
7ea1dc4
a1d8162
f02ee1f
87d54d2
54ca2b1
523c84f
2aa66fc
14ac18c
4dfec50
70d5d97
dfc2143
29f2d18
045f747
2abdd09
ff17050
17e3f47
999fc8b
7b36025
44af977
22c9fea
9445c93
09f33aa
e693e34
12cf8bb
1b6e4dd
80d117d
d6b8b6f
bb03eb4
6bb9fa7
13ec792
e595239
7ab597b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,3 +15,7 @@ bin/ | |
|
||
/text-ui-test/ACTUAL.TXT | ||
text-ui-test/EXPECTED-UNIX.TXT | ||
/data/ | ||
|
||
.vscode/ | ||
text-ui-test/data/ |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
Gemfile.lock | ||
_site/ |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,13 @@ | ||
# About us | ||
--- | ||
layout: page | ||
title: About Us | ||
--- | ||
|
||
| Display | Name | Github Profile | Portfolio | | ||
|-----------------------------------------------------------|:-----------------:|:----------------------------------------:|:-----------------------------------------:| | ||
| ![](https://via.placeholder.com/100.png?text=Photo) | Alexander Wolters | [Github](https://github.com/AlWo223) | [Portfolio](docs/team/johndoe.md) | | ||
| ![](https://via.placeholder.com/100.png?text=Photo) | Nihal | [Github](https://github.com/nihalzp) | [Portfolio](docs/team/nihalzp.md) | | ||
| ![](https://github.com/DaDevChia) | Dylan Chia | [Github](https://github.com/DaDevChia) | [Portfolio](https://github.com/DaDevChia) | | ||
| ![](https://via.placeholder.com/100.png?text=Photo) | Yi Cheng | [Github](https://github.com/yicheng-toh) | [Portfolio](docs/team/yicheng.md) | | ||
| ![](https://avatars.githubusercontent.com/u/24489025?s=100) | Yang Ming-Tian | [Github](https://github.com/skylee03) | [Portfolio](docs/team/skylee03.md) | | ||
|
||
Display | Name | Github Profile | Portfolio | ||
--------|:----:|:--------------:|:---------: | ||
![](https://via.placeholder.com/100.png?text=Photo) | John Doe | [Github](https://github.com/) | [Portfolio](docs/team/johndoe.md) | ||
![](https://via.placeholder.com/100.png?text=Photo) | Don Joe | [Github](https://github.com/) | [Portfolio](docs/team/johndoe.md) | ||
![](https://via.placeholder.com/100.png?text=Photo) | Ron John | [Github](https://github.com/) | [Portfolio](docs/team/johndoe.md) | ||
![](https://via.placeholder.com/100.png?text=Photo) | John Roe | [Github](https://github.com/) | [Portfolio](docs/team/johndoe.md) | ||
![](https://via.placeholder.com/100.png?text=Photo) | Don Roe | [Github](https://github.com/) | [Portfolio](docs/team/johndoe.md) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,211 @@ | ||
# Developer Guide | ||
--- | ||
layout: page | ||
title: Developer Guide | ||
--- | ||
|
||
- Table of Contents | ||
{:toc} | ||
|
||
## Acknowledgements | ||
|
||
{list here sources of all reused/adapted ideas, code, documentation, and third-party libraries -- include links to the original source as well} | ||
|
||
## Design & implementation | ||
## Design | ||
|
||
This section provides a high-level explanation of the design and implementation of AthletiCLI, | ||
supported by UML diagrams and short code snippets to illustrate the flow of data and interactions between the | ||
components. | ||
|
||
|
||
### Architecture | ||
|
||
Given below is a quick overview of main components and how they interact with each other. | ||
|
||
**Main components of the architecture** | ||
|
||
**`AthletiCLI`** is in charge of the app launch and shut down. | ||
|
||
The bulk of the AthletiCLI’s work is done by the following components, with each of them corresponds to a package: | ||
|
||
* [`UI`](https://github.com/AY2324S1-CS2113-T17-1/tp/tree/master/src/main/java/athleticli/ui): The UI of AthletiCLI. | ||
* [`Storage`](https://github.com/AY2324S1-CS2113-T17-1/tp/tree/master/src/main/java/athleticli/storage): Reads data from, and writes data to, the hard disk. | ||
* [`Data`](https://github.com/AY2324S1-CS2113-T17-1/tp/tree/master/src/main/java/athleticli/data): Holds the data of AthletiCLI in memory. | ||
* [`Commands`](https://github.com/AY2324S1-CS2113-T17-1/tp/tree/master/src/main/java/athleticli/commands): The command executors. | ||
|
||
[`Exceptions`](https://github.com/AY2324S1-CS2113-T17-1/tp/tree/master/src/main/java/athleticli/exceptions) represents exceptions used by multiple other components. | ||
|
||
### UI Component | ||
|
||
### Storage Component | ||
|
||
### Data Component | ||
|
||
### Commands Component | ||
|
||
## Implementation | ||
|
||
### Diet Management in AthletiCLI | ||
|
||
#### [Implemented] Setting Up, Editing, Deleting, Listing, and Finding Diets | ||
|
||
Regardless of the operation you are performing on diets (setting up, editing, deleting, listing, or finding), the process follows a general five-step pattern in AthletiCLI: | ||
|
||
1. **Input Processing**: The user's input is passed through AthletiCLI to the Parser Class. Examples of user inputs include: | ||
- `add-diet calories/500 protein/20 carb/50 fat/10 datetime/2021-09-01 06:00` for adding a diet. | ||
- `edit-diet 1 calories/500 protein/20 carb/50 fat/10 datetime/2021-09-01 06:00` for editing a diet. | ||
- `delete-diet 1` for deleting a diet. | ||
- `list-diet` for listing all diets. | ||
- `find-diet 2021-09-01` for finding diets of a particular date. | ||
|
||
2. **Command Identification**: The Parser Class identifies the type of diet operation and passes the necessary parameters. | ||
|
||
3. **Command Creation**: An instance of the corresponding command class is created (e.g., AddDietCommand, EditDietCommand, etc.) and returned to AthletiCLI. | ||
|
||
4. **Command Execution**: AthletiCLI executes the command, interacting with the data instance of DietList to perform the required operation. | ||
|
||
5. **Result Display**: A message is returned post-execution and passed through AthletiCLI to the UI for display to the user. | ||
|
||
By following these general steps, AthletiCLI ensures a streamlined process for managing diet-related tasks. | ||
|
||
### [Implemented] Setting Up of Diet Goals | ||
|
||
This following sequence diagram show how the 'set-diet-goal' command works: | ||
|
||
<p align="center" width="100%"> | ||
<img width="80%" src="images/setDietGoalUmlSequenceDiagram.svg" alt="'set-diet-goal' Sequence Diagram"/> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. include self-invocation of initializeIntermmediateDietGoals method? |
||
</p> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe the diagram needs to be updated to reflect the current implementation? It seems to be a little different. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe it would help to include variable names in the diagram? I.e. it may not be immediately clear which object's execute() is called unless we look into the code/make educated guesses |
||
|
||
Step 1. The input from the user ("set-diet-goal fats/1") runs through AthletiCLI to the Parser Class. | ||
|
||
Step 2. The Parser Class will identify the request as setting up a diet goal and pass in the parameters | ||
"fats/1". | ||
|
||
Step 3. A temporary dietGoalList is created to store newly created diet goals. | ||
|
||
Step 4. The inputs are verified against our lists of approved diet goals. | ||
|
||
Step 5. For each of the diet goals that are valid, a dietGoal object will be created and stored in the | ||
temporary dietGoalList. | ||
|
||
Step 6. The Parser then creates for an instance of SetDietGoalCommand and returns the instance to | ||
AthletiCLI. | ||
|
||
Step 7. AthletiCLI will execute the SetDietGoalCommand. This adds the dietGoals that are present in the | ||
temporary list into the data instance of DietGoalList which will be kept for records. | ||
|
||
Step 8. After executing the SetDietGoalCommand, SetDietGoalCommand returns a message that is passed to | ||
AthletiCLI to be passed to UI(not shown) for display. | ||
|
||
#### [Implemented] Adding activities | ||
The `add-activity` feature allows users to add a new activity into the application. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. might be better to put the adding of activities in a separate section instead of under diet goals since the adding of activities is not related to the diet goals based on sequence diagram. |
||
These are the main components behind the architecture of the `add-activity` feature: | ||
1. `AthletiCLI`: faciliates the mechanism. It captures the input and calls the parser and execution. | ||
2. `Parser`: parses the user input and generates the appropriate command object and activity | ||
instance. | ||
3. `AddActivityCommand`: encapsulates the execution of the `add-activity` command. It adds | ||
the activity to the data. | ||
4. `Activity`: represents the activity that is to be added. | ||
5. `Data`: holds current state of the activity list. | ||
6. `ActivityList`: maintains the list of all added activities. | ||
|
||
Given below is an example usage scenario and how the add mechanism behaves at each step. | ||
|
||
**Step 1 - Input Capture:** The user issues an `add-activity ...` which is captured and passed to the Parser by the | ||
running AthletiCLI instance. | ||
|
||
**Step 2 - Activity Parsing:** The Parser parses the raw input to obtain the arguments of the activity. Given that all | ||
parameters are provided correctly and no exception is thrown, a new activity object is created. | ||
|
||
**Step 3 - Command Parsing:** In addition the parser will create an `AddActivityCommand` object with the newly added | ||
activity attached to it. The command implements the `AddActivityCommand#execute()` operation and is passed to | ||
the AthletiCLI instance. | ||
|
||
**Step 4 - Activity Addition:** The AthletiCLI instance executes the `AddActivityCommand` object. The command will | ||
access the data and retrieve the currently stored list of activities stored inside it. The new `Activity` object is | ||
added to the list. | ||
|
||
**Step 5 - User Interaction:** Once the activity is successfully added, a confirmation message is displayed to the user. | ||
|
||
The following sequence diagram shows how the `add-activity` operation works: | ||
<p align="center" width="100%"> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. may want to maintain same format of explaining feature implementation to ensure consistency; ie. similar to [Implemented] Setting Up of Diet Goals where image of sequence diagram is first attached before detailed explanation. |
||
<img width="80%" src="DeveloperGuide/AddActivity.png" alt="Sequence Diagram of add-activity`"/> | ||
</p> | ||
|
||
### [Proposed] Implementation of DietGoalList | ||
|
||
The current implementation of DietGoalList is an ArrayList. | ||
It helps to store dietGoals, however it is not efficient in searching for a particular dietGoal. | ||
At any instance of time, there could only be the existence of one dietGoal. | ||
Verifying if there is an existence of a dietGoal using an ArrayList takes O(n) time, where n is the number of dietGoals. | ||
The proposed change will be to change the underlying data structure to a hashmap for amortised O(1) time complexity | ||
for checking the presence of a dietGoal. | ||
|
||
### Sleep Management in AthletiCLI | ||
|
||
#### [Implemented] Adding, Editing, Deleting, Listing Sleep | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is there find function for sleep entries as well? |
||
1. **Input Processing**: The user's input is passed through AthletiCLI to the Parser Class. Examples of user inputs include: | ||
- "add-sleep hours/8 datetime/2021-09-01 06:00" for adding sleep. | ||
- "edit-sleep 1 hours/8 datetime/2021-09-01 06:00" for editing sleep. | ||
- "delete-sleep 1" for deleting sleep. | ||
- "list-sleep" for listing all sleep. | ||
|
||
2. **Command Identification**: The Parser Class identifies the type of sleep operation and passes the necessary parameters. | ||
|
||
3. **Command Creation**: An instance of the corresponding command class is created (e.g., AddSleepCommand, EditSleepCommand, etc.) and returned to AthletiCLI. | ||
|
||
4. **Command Execution**: AthletiCLI executes the command, interacting with the data instance of SleepList to perform the required operation. | ||
|
||
5. **Result Display**: A message is returned post-execution and passed through AthletiCLI to the UI for display to the user. | ||
|
||
{Describe the design and implementation of the product. Use UML diagrams and short code snippets where applicable.} | ||
|
||
|
||
## Product scope | ||
### Target user profile | ||
|
||
{Describe the target user profile} | ||
AthletiCLI is designed for athletic individuals who are committed to optimizing their performance. | ||
|
||
These users are highly disciplined and engaged not only in regular, intense physical training but also in nutrition, mental conditioning, and recovery. | ||
|
||
They are looking for a holistic tool that integrates all facets of an athletic lifestyle. AthletiCLI serves as a daily or weekly companion, designed to monitor, track, and analyze various elements crucial for high-level athletic performance. | ||
|
||
### Value proposition | ||
|
||
{Describe the value proposition: what problem does it solve?} | ||
AthletiCLI provides a streamlined, integrated solution for athletic individuals focused on achieving peak performance. | ||
|
||
While the app includes robust capabilities for tracking physical training metrics, it also offers features for monitoring dietary habits and sleep metrics. | ||
|
||
By providing a comprehensive view of various performance-related factors over time, AthletiCLI enables athletes to identify trends, refine their training and lifestyle habits, and optimize outcomes. The app is more than a tracking tool—it's a performance optimization platform that takes into account the full spectrum of an athlete's life. | ||
|
||
## User Stories | ||
|
||
|Version| As a ... | I want to ... | So that I can ...| | ||
|--------|----------|---------------|------------------| | ||
|v1.0|new user|see usage instructions|refer to them when I forget how to use the application| | ||
|v2.0|user|find a to-do item by name|locate a to-do without having to go through the entire list| | ||
| Version | As a ... | I want to ... | So that I can ... | | ||
|---------|---------------------------------|----------------------------|----------------------------------------------------------------------------------------| | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nice list of stories! |
||
| v1.0 | health-conscious user | add my dietary information | keep track of my daily calorie and nutrient intake | | ||
| v1.0 | organized user | delete a dietary entry | remove outdated or incorrect data from my diet records | | ||
| v1.0 | fitness enthusiast | view all my diet records | have a clear overview of my dietary habits and make informed decisions on my diet | | ||
| v1.0 | new user | see usage instructions | refer to them when I forget how to use the application | | ||
| v1.0 | motivated weight-conscious user | set diet goals | have the motivation to work towards keeping weight in check. | | ||
| v1.0 | forgetful user | see all my diet goals | remind myself of all the diet goals I have set. | | ||
| v1.0 | regretful user | remove my diet goals | I can rescind the strict goals I set previously when I find the goals too far fetched. | | ||
| v1.0 | motivated user | update my diet goals | I can work towards better version of myself by setting stricter goals. | | ||
| v1.0 | sleep deprived user | add my sleep information | keep track of my sleep habits and identify areas for improvement | | ||
| v1.0 | sleep deprived user | delete a sleep entry | remove outdated or incorrect data from my sleep records | | ||
| v1.0 | sleep deprived user | view all my sleep records | have a clear overview of my sleep habits and make informed decisions on my sleep | | ||
| v1.0 | sleep deprived user | edit my sleep entries | correct any mistakes or update my sleep information as needed | | ||
| v2.0 | user | find a to-do item by name | locate a to-do without having to go through the entire list | | ||
| v2.0 | meticulous user | edit my dietary entries | correct any mistakes or update my diet information as needed | | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. may want to be more specific in identifying what are the possible criterions of "to-do". for example, is it referring to an activity / diet / sleep entry, or is it the goals? |
||
| v2.0 | active user | set activity goals | work towards a specific fitness target for different sports activities. | | ||
| v2.0 | adaptable athlete | edit my activity goals | modify my fitness targets to align with my current fitness level and schedule. | | ||
| v2.0 | organized athlete | list all my activity goals | have a clear overview of my set targets and track my progress easily. | | ||
| v2.0 | meticulous user | find my diets by date | easily retrieve my dietary records for a specific day and monitor my eating habits. | | ||
|
||
## Non-Functional Requirements | ||
|
||
{Give non-functional requirements} | ||
1. AthletiCLI should work on Windows, MacOS and Linux that has java 11 installed. | ||
2. AthletiCLI should be able to store data locally. | ||
3. AthletiCLI should be able to work offline. | ||
4. AthletiCLI should be easy to use. | ||
|
||
## Glossary | ||
|
||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Perhaps it might be better to use a better variable name instead of |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
@startuml | ||
'https://plantuml.com/sequence-diagram | ||
skinparam Style strictuml | ||
skinparam SequenceMessageAlignment center | ||
|
||
!define LOGIC_COLOR #3333C4 | ||
!define LOGIC_COLOR_T1 #7777DB | ||
!define LOGIC_COLOR_T2 #5252CE | ||
!define LOGIC_COLOR_T3 #1616B0 | ||
!define LOGIC_COLOR_T4 #101086 | ||
|
||
participant ":AthletiCLI" as AthletiCLI LOGIC_COLOR | ||
participant ":Parser" as Parser #lightblue | ||
participant "a:Activity" as Activity #yellow | ||
participant "c:AddActivityCommand" as AddActivityCommand #lightgreen | ||
participant "data:Data" as Data #lightgrey | ||
participant "activities:ActivityList" as activities #lightgrey | ||
|
||
AthletiCLI++ | ||
AthletiCLI -> Parser++: parseCommand(userInput) | ||
Parser -> Parser++: parseActivity(arguments) | ||
Parser -> Activity++: Activity() | ||
Activity --> Parser--: a | ||
Parser-- | ||
Parser -> AddActivityCommand++: parseAddActivityCommand(arguments) | ||
AddActivityCommand --> Parser--: c | ||
Parser --> AthletiCLI--: c | ||
|
||
AthletiCLI -> AddActivityCommand++: execute(a, data) | ||
AddActivityCommand -> Data++: getActivities() | ||
Data --> activities++ | ||
activities --> Data--: activities | ||
|
||
Data --> AddActivityCommand--: activities | ||
AddActivityCommand -> activities++: add(a) | ||
activities --> AddActivityCommand-- | ||
AddActivityCommand -> AthletiCLI--: message | ||
@enduml |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# frozen_string_literal: true | ||
|
||
source "https://rubygems.org" | ||
|
||
git_source(:github) {|repo_name| "https://github.com/#{repo_name}" } | ||
|
||
gem 'jekyll' | ||
gem 'github-pages', group: :jekyll_plugins | ||
gem 'wdm', '~> 0.1.0' if Gem.win_platform? | ||
gem 'webrick' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In published website, the numbering reads 1., 7, ..., 10. Is there something that can be done about this?