Skip to content

Commit

Permalink
Merge pull request #381 from currynia/branch-dg
Browse files Browse the repository at this point in the history
Implementation for addgrade
  • Loading branch information
SwaminathanViswa authored Nov 12, 2024
2 parents 0f179cc + d2e6394 commit b2e666b
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
15 changes: 15 additions & 0 deletions docs/DeveloperGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,21 @@ Note: While the diagram shows the lifeline of objects even after their deletion,
2. KonTActs will create a contact of Tom with the given details before adding it to the contact list.
3. The contact is then displayed in the UI, along with a success message.

### Add Grade implementation

**Logic**:
1. `AddGradeCommand.java`
2. `AddGradeCommandParser.java`

The `addGrade` command is used by KonTActs to add an assignment and grade to a contact.
The added assignments and grades uses `HashMap` to store the assignments and grades in each person object.

This is illustrated in the activity diagram below:

<puml src="diagrams/AddGradeImpl.puml" width="450" />

* addGrade checks whether the assignment exists in the database, if the score is valid and if the person exists in the contacts.
* If the conditions are satisfied, the assignment is added to the `HashMap` in the person object which stores all the added assignments of that person.

### MarkCommand

Expand Down
10 changes: 10 additions & 0 deletions docs/diagrams/AddGradeImpl.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
@startuml
start
:User executes addGrade command with assignment name, score and name of person;
if () then ([AssignmentExists and ScoreValid and PersonExists])
:Specified assignment and score is added to specified person;
else ([else])
:addGrade command returns an error to the user;
endif
stop
@enduml

0 comments on commit b2e666b

Please sign in to comment.