-
Notifications
You must be signed in to change notification settings - Fork 140
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-W13-2] FitTrack #22
base: master
Are you sure you want to change the base?
Changes from 219 commits
8f035e7
de93e86
b786d9a
c362a33
e1591c7
75d8979
b028922
a5c7bc6
93aeb62
29ca26a
b4d6db1
b746292
3f2cedc
bb19f78
e1f2ce6
3baea89
f6c3de1
11f8d5a
da7d9a1
ea1cbfd
52ba4bd
0971c49
da54dc1
e745817
6f3bc32
3d49df3
898ff87
cd70cea
57707f2
2ca9916
e8c9b61
d65536a
7d69e55
d627d89
ede10cb
27330af
e09602e
c3efc0e
9684552
54638bf
320e3d6
03e4bec
89fb56f
e54fb77
95bc537
57c7fa9
a538e8f
9678a96
aa10907
cc74aa9
4c9044f
ae72e9f
d82ad0d
62b13a5
0946bed
16d5a06
6664921
babdbd6
aea96dd
4d59274
5e75de1
cb10c4f
ca690bb
22ed9a7
9d92422
2aa142e
11ab74e
67e9341
5c3457c
fa27c4c
ab7b3c4
b86ec29
1599342
a9a67c1
bb8c893
cc38cf2
6a57017
1aa47aa
c97f175
88b4894
fba8cbf
8b27dfc
4965b96
0b87fd4
e484bf8
973345e
ef800fe
10f4d90
3b33856
641591f
813d0f7
e4328f4
72cd6a8
31c8369
fb73bc8
88c4713
dc00214
2e15f77
db03ae8
caa64a3
2f78230
fcd8367
25ab1f5
8baf003
a33037b
749f9ca
766fdb6
f11edb5
c4c99fc
2429460
3e31a69
c29b0d7
88e798c
faa6d9c
0407a5f
2d15dc2
be8af2f
caca0ab
d674f47
41dcdbc
307f08e
ff07edc
dddbd4d
7404bf1
0faf2c3
10f3da1
3520e35
759a24a
bda276f
5bcdb1d
816a175
4d2edef
0af1b32
226119e
303f7e7
2624865
45f75ca
717ce23
b6dec0d
1cee12d
d38f792
df27a80
a4f5fa8
493e2de
d0fbbce
226c6bc
9e2218a
fb6dd26
2687501
ce05b52
deefed1
04dfc5b
b771c61
5ffbdb9
617cc90
98438eb
160eb23
c1a0082
1f9058e
dee4581
b3631dd
e8cf557
93dc60c
c5070b9
d65e763
aab3c9e
66ae3a3
1ce5be8
ea3098a
e766127
c4e3e28
7178a5f
b28266f
0fd769c
2bf10e8
b781514
332830b
3a46c44
63078b5
6a95f27
59459f2
59d7e03
db6e070
41e9850
93d6150
7e069a0
66f6115
fc22211
77398ca
d64cd83
b359180
9f3a672
0075c64
89dd172
5001b50
ab0b8bf
6573bf7
f0a4f8e
dee71e9
94f900b
85051d5
4291b4d
c348ec9
e8a9471
a71af52
f41fff2
ea64fc1
dac86de
f6da4c4
e6338f4
ab26ad6
340f387
85678fb
5ef38a3
8ecfa09
d816cd6
f810785
8ff5da9
c835d14
acd1175
07b9755
c6b71c5
12aa540
5b2f65a
97682a8
bcc6982
5e2efc9
3679bc7
d5370c7
e9394fc
4717a5b
2769193
c3ee374
61d432e
3b8d23b
38e3631
24d05a7
43c9494
15c0e04
7746629
77c7e1a
3b34ba1
639c903
bfe6bf4
78479f9
06fe873
8da8723
e2aee92
97cd54f
5a63a3f
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,5 @@ bin/ | |
|
||
/text-ui-test/ACTUAL.TXT | ||
text-ui-test/EXPECTED-UNIX.TXT | ||
FitTrackLogger.log | ||
FitTrackLogger.log.lck |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
Oct 31, 2024 11:16:20 AM fittrack.logger.FitTrackLogger setupLogger | ||
INFO: Logger successfully initialized | ||
Oct 31, 2024 11:16:20 AM fittrack.storage.Storage initialiseSaveFile | ||
INFO: Accessing existing save file... | ||
Oct 31, 2024 11:16:20 AM fittrack.storage.Storage loadSaveFile | ||
INFO: Save file successfully loaded. |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -42,5 +42,6 @@ checkstyle { | |
} | ||
|
||
run{ | ||
enableAssertions = true | ||
standardInput = System.in | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,8 @@ | ||
# About us | ||
|
||
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) | ||
Display | Name | Github Profile | Portfolio | ||
--------|:----------:|:----------------------------------:|:---------: | ||
![](https://via.placeholder.com/100.png?text=Photo) | Zackermax See Zheng Feng | [Github](https://github.com/Zackermax) | [Portfolio](docs/team/zackermaxsee.md) | ||
![](https://via.placeholder.com/100.png?text=Photo) | Ng Chee Kiang | [Github](https://github.com/CheeKiangg) | [Portfolio](docs/team/CheeKiang.md) | ||
![](https://via.placeholder.com/100.png?text=Photo) | Marcus Wong | [Github](https://github.com/TheDinos) | [Portfolio](docs/team/marcuswong.md) | ||
![](https://via.placeholder.com/100.png?text=Photo) | Avjay Bhar | [Github](https://github.com/Yvorm) | [Portfolio](docs/team/johndoe.md) | ||
![](https://via.placeholder.com/100.png?text=Photo) | Ayushi Yadav | [Github](https://github.com/ayushi0803) | [Portfolio](docs/team/ayushi.md) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
@startuml | ||
|
||
skinparam linetype ortho | ||
hide circle | ||
skinparam classAttributeIconSize 0 | ||
skinparam classBackgroundColor White | ||
skinparam classBorderColor Black | ||
|
||
' Abstract class | ||
abstract class Calculator { | ||
- static final int AGE_RANGE_LOWER_START : int | ||
- static final int AGE_RANGE_LOWER_END : int | ||
- static final int AGE_RANGE_UPPER_START : int | ||
- static final int AGE_RANGE_UPPER_END : int | ||
+ static getPointsFromTable(Map<LookUpKey, TreeMap<Integer, Integer>>, Gender, int, int, boolean) : int | ||
+ static addAgeSubTable(Map<LookUpKey, TreeMap<Integer, Integer>>, Gender, int, int[][], boolean) : void | ||
+ static addAllTables(Map<LookUpKey, TreeMap<Integer, Integer>>, Gender, int[][][], boolean) : void | ||
} | ||
|
||
' Derived classes | ||
class PullUpCalculator { | ||
- static final Map<LookUpKey, TreeMap<Integer, Integer>> pullUpTable | ||
- static final boolean reverseOrder | ||
+ static calculatePoints(Gender, int, int) : int | ||
+ static initialiseMaleData() : void | ||
+ static initialiseFemaleData() : void | ||
} | ||
|
||
class ShuttleRunCalculator { | ||
- static final Map<LookUpKey, TreeMap<Integer, Integer>> shuttleRunTable | ||
- static final boolean reverseOrder | ||
+ static calculatePoints(Gender, int, int) : int | ||
+ static initialiseMaleData() : void | ||
+ static initialiseFemaleData() : void | ||
} | ||
|
||
class SitAndReachCalculator { | ||
- static final Map<LookUpKey, TreeMap<Integer, Integer>> sitAndReachTable | ||
- static final boolean reverseOrder | ||
+ static calculatePoints(Gender, int, int) : int | ||
+ static initialiseMaleData() : void | ||
+ static initialiseFemaleData() : void | ||
} | ||
|
||
class SitUpCalculator { | ||
- static final Map<LookUpKey, TreeMap<Integer, Integer>> sitUpTable | ||
- static final boolean reverseOrder | ||
+ static calculatePoints(Gender, int, int) : int | ||
+ static initialiseMaleData() : void | ||
+ static initialiseFemaleData() : void | ||
} | ||
|
||
class StandingBroadJumpCalculator { | ||
- static final Map<LookUpKey, TreeMap<Integer, Integer>> broadJumpTable | ||
- static final boolean reverseOrder | ||
+ static calculatePoints(Gender, int, int) : int | ||
+ static initialiseMaleData() : void | ||
+ static initialiseFemaleData() : void | ||
} | ||
|
||
class WalkAndRunCalculator { | ||
- static final Map<LookUpKey, TreeMap<Integer, Integer>> walkAndRunTable | ||
- static final boolean reverseOrder | ||
+ static calculatePoints(Gender, int, int) : int | ||
+ static initialiseMaleData() : void | ||
+ static initialiseFemaleData() : void | ||
} | ||
|
||
' Relationships | ||
Calculator <|--- PullUpCalculator | ||
Calculator <|-- ShuttleRunCalculator | ||
Calculator <|--- SitAndReachCalculator | ||
Calculator <|-- SitUpCalculator | ||
Calculator <|--- StandingBroadJumpCalculator | ||
Calculator <|-- WalkAndRunCalculator | ||
|
||
@enduml |
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. 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. 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. 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. Overall, really well structured DG, diagrams really clarify the functionalities of the app |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,9 +4,144 @@ | |
|
||
{list here sources of all reused/adapted ideas, code, documentation, and third-party libraries -- include links to the original source as well} | ||
|
||
## Setting up, getting started | ||
First , **fork** this repo, and clone the fork into your computer. | ||
1. **Configure the JDK**: Follow the guide [se-edu/guides] IDEA: Configuring the JDK to ensure Intellij is configured | ||
to use **JDK 17**. | ||
2. **Import the project as a Gradle project**: Follow the guide [se-edu/guides] IDEA: Importing a Gradle project | ||
to import the project into IDEA. | ||
3. Verify the setup: | ||
(i) Run the FitTrack.Main and try a few commands like `help`. | ||
(ii) Run the tests to ensure that all of it pass. | ||
|
||
## Design & implementation | ||
|
||
{Describe the design and implementation of the product. Use UML diagrams and short code snippets where applicable.} | ||
## Software Architecture | ||
![Architecture.png](Images/Archi_Architecture.png) | ||
|
||
**FitTrack** is the main class and entry point of the application. It manages high level functionalities by coordinating the following classes: | ||
|
||
| Class | Functionality | | ||
|-----------------|--------------------------------------------------------------------------------------------------------------| | ||
| FitTrackLogger | Manages logging for the application, ensuring errors and important events are properly recorded | | ||
| Storage | Manages saving and loading data from a persistent storage file | | ||
| User | Records the user’s information, such as age and gender, and provides methods to modify or retrieve this data | | ||
| Parser | Handles parsing of user input, converting it into commands and actions | | ||
| Ui | Handles user interaction and CLI output, printing messages and data to the console | | ||
| TrainingSession | Represents a single training session, including exercises and metadata (e.g. date and description) | | ||
| Exercise | Represents different types of exercises available in the application, like pull-ups or shuttle runs | | ||
|
||
## Features | ||
|
||
### Storage | ||
![Storage.png](Images/Class_Storage.png) | ||
|
||
### Set User | ||
When the application starts up, it will prompt the user for their gender and age via the Set User feature. | ||
Their input is processed by Parser and stored in an instance of the User class. | ||
Upon successful setting of the gender and age fields, a confirmation of the user's gender and age will be printed in the CLI via the Ui class. | ||
After this initialization process, if the user desires, they can set their gender and age again at any time by calling the "set" command. | ||
|
||
![SetUser.png](Images/Class_SetUser.png) | ||
|
||
### Add Training Session | ||
![AddTrainingSession.png](Images/Class_AddTrainingSession.png) | ||
|
||
#### 1. Class Interaction Overview | ||
When the user adds a new training session, an instance of the `TrainingSession` class is created. | ||
This instance initializes an EnumMap, which instantiates the 6 `ExerciseStation` child classes with | ||
their initial values. | ||
Below is a class diagram showing the EnumMap after an instance of `TrainingSession` is created. | ||
![Class_TrainingSessionInitialState.png](Images/Class_TrainingSessionInitialState.png) | ||
|
||
#### 2. Sequence of Event | ||
![Sequence_addTrainingSessionCommand.png](Images%2FSequence_addTrainingSessionCommand.png) | ||
1) **User Inputs Add command**:The User initiates the "add <name of the training session>" command by | ||
calling Parser with the input. | ||
2) **Instantiation of TrainingSession**: The Parser creates a new TrainingSession object with the | ||
current time, description, and user. | ||
3) **Instantiation of Exercise Stations**: Within TrainingSession class, all 6 subclasses of exercise | ||
stations are instantiated. | ||
4) **UI Interaction**: The Parser calls Ui.printAddedSession(sessionList), which: | ||
(i) Begins a UI segment | ||
(ii) Prints a session message | ||
(iii) Prints the description of the last added session | ||
(iv) Calls printSessionCount to show the total count | ||
(v) Ends the segment. | ||
4) Refer to Section on Edit Exercise and Point Calculation for specific implementation of | ||
performance metric and point conversion. | ||
|
||
### Delete Training Session | ||
When Parser detects the "delete" command, the TrainingSession instance at the user's specified index in sessionList will be | ||
copied into a new private TrainingSession instance called sessionToDelete. The original instance in sessionList will | ||
then be deleted. The new private instance is used to print the details of the deleted session, giving the user | ||
confirmation that the TrainingSession they wished to delete has been successfully deleted. The new TrainingSession | ||
instance is then disposed of. | ||
|
||
![DeleteTrainingSession.png](Images/Class_DeleteTrainingSession.png) | ||
|
||
### List Training Sessions | ||
When Parser detects the "list" command, it calls printSessionList() followed by printSessionCount(). | ||
printSessionList() first checks if sessionList is empty. If sessionList is empty, it prints a message saying so. | ||
If sessionList is not empty, it will be iterated through. | ||
For each TrainingSession in sessionList, getSessionDescription will be called, returning its details as a String. | ||
The TrainingSession's index will be printed, followed by the session description before iterating to the next index. | ||
|
||
![ListTrainingSessions.png](Images/Class_ListTrainingSessions.png) | ||
|
||
### View Training Session | ||
When Parser detects the "view" command, it calls printSessionView() on the user's specified session index. | ||
This in turn calls viewSession(), which outputs the details of the TrainingSession instance in the CLI. | ||
This process fetches the details of each of the 6 ExerciseStation classes, which fetch details from the Calculator classes. | ||
|
||
![ViewTrainingSession.png](Images/Class_ViewTrainingSession.png) | ||
|
||
### Edit Exercise | ||
|
||
The **Edit Exercise** feature is managed by the `TrainingSession` class, and is primarily carried out by its | ||
`editExercise()` function. This feature utilizes the `setPerformance()`and `getReps()` methods from the | ||
`ExerciseStation` classes to edit the repetitions and timings for the user’s selected | ||
exercises. Additionally, it calculates the points the user will earn for each exercise based on the updated "rep" or | ||
"timing" values. | ||
|
||
#### Step 2: Editing a Training Session | ||
|
||
When the user wishes to edit a training session, they specify an `Exercise` Enum, and the reps/timing to be inputted. | ||
These variables are then passed to the`editExercise` function. This function calls the relevant methods to update the | ||
repetitions or timings and calculates the corresponding points for the specified exercise. | ||
|
||
The following sequence diagram illustrates the function calls involved in this process: | ||
|
||
![Sequence_editExercise.png](Images/Sequence_editExercise.png) | ||
|
||
Additionally, the state diagram below shows the end state of the `editExercise` function after execution of the command, | ||
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. The state diagram is a specific kind of UML behavioral diagram.
I don't think that's what you're referring to here, as this seems like structural? |
||
`editExercise(Exercise.PULL_UP, 1)` and `editExercise(Exercise.SHUTTLE_RUN, "16.0")`: | ||
|
||
![Class_TrainingSessionEditState.png](Images/Class_TrainingSessionEditState.png) | ||
|
||
### Points Calculation | ||
|
||
The **points calculation feature** is a significant part of the `ExerciseStation` system. It allows for the calculation | ||
of user-specific points based on their performance in various exercises (e.g., pull-ups, sit-ups). This process | ||
involves interaction between the `ExerciseStation` and the `Calculator` classes, ensuring that the correct points are | ||
assigned based on predefined lookup tables. | ||
|
||
#### 1. Class Interaction Overview | ||
|
||
Each `ExerciseStation` subclass (e.g., `PullUpStation`, `SitUpStation`) has its own implementation of the `getPoints()` | ||
method. The main responsibility of this method is to invoke the `calculatePoints()` function from the | ||
respective **calculator** class (e.g., `PullUpCalculator`, `SitUpCalculator`), which holds the points calculation logic. | ||
|
||
#### 2. Sequence of Events: | ||
![getPointsSequenceDiagram.png](getPointsSequenceDiagram.png) | ||
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. 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. Could the "PullUpStation" and "PullUpCalculator" be named to be generic names to showcase what is written in the description? |
||
1. **User Inputs Performance**: The user’s performance (e.g., number of pull-ups) is passed to the | ||
`setPerformance()` method in the exercise station. | ||
|
||
2. **Invoke Points Calculation**: Once the performance is set, the `getPoints()` method is called. | ||
This method interacts with the calculator class (e.g., `PullUpCalculator`) to compute the points. | ||
|
||
3. **Calculator Logic**: The calculator class uses a lookup table, which maps the user's performance | ||
to points based on their age and gender. The points are returned to the exercise station, where they are stored. | ||
|
||
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. Are the user stories below still unchanged from the template? |
||
|
||
## Product scope | ||
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. |
||
|
@@ -20,10 +155,19 @@ | |
|
||
## 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| | ||
Priorities: High (must have) - * * *, Medium (nice to have) - * *, Low (unlikely to have) - * | ||
|
||
| Priority | As a ... | I want to ... | So that I can ... | | ||
|----------|----------|----------------------------------------|-----------------------------------------------------| | ||
| *** | new user | see usage instructions | refer to them when I forget how to use the app | | ||
| *** | user | add a new training session | record my NAPFA training progress | | ||
| *** | user | edit my new training session | record the reps/time I attained for each exercise | | ||
| *** | user | delete a training session | remove a session that was added by mistake | | ||
| *** | user | view a list of past training sessions | track the number of training sessions I have done | | ||
| *** | user | view the details of a training session | have an overview of my performance for that session | | ||
| *** | user | store my training sessions | keep a record of my sessions when the app is closed | | ||
| ** | user | calculate my NAPFA points per exercise | conveniently view my standing for each station | | ||
| * | user | know my NAPFA achievement level | know my NAPFA standard at a glance | | ||
|
||
## Non-Functional Requirements | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
@startuml | ||
hide circle | ||
skinparam classAttributeIconSize 0 | ||
skinparam classBackgroundColor White | ||
skinparam classBorderColor Black | ||
|
||
rectangle Exercise <<enumeration>> { | ||
} | ||
|
||
rectangle User { | ||
} | ||
|
||
rectangle FitTrackLogger { | ||
} | ||
|
||
rectangle Storage { | ||
} | ||
|
||
rectangle FitTrack { | ||
} | ||
|
||
rectangle Parser { | ||
} | ||
|
||
rectangle Ui { | ||
} | ||
|
||
rectangle TrainingSession { | ||
} | ||
|
||
rectangle ExerciseStation { | ||
} | ||
|
||
rectangle Calculator { | ||
} | ||
|
||
FitTrack --> Parser | ||
FitTrack --> Ui | ||
FitTrack --> Storage | ||
FitTrack --> User | ||
FitTrack --> FitTrackLogger | ||
|
||
Parser --> TrainingSession | ||
Parser --> Exercise | ||
Parser --> User | ||
Parser --> Ui | ||
|
||
Ui --> User | ||
Ui --> TrainingSession | ||
|
||
Storage --> TrainingSession | ||
Storage --> FitTrackLogger | ||
|
||
TrainingSession --> User | ||
TrainingSession --> Exercise | ||
TrainingSession --> ExerciseStation | ||
|
||
ExerciseStation --> Calculator | ||
|
||
@enduml |
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.
This diagram is abit hard to look at