Skip to content

Commit

Permalink
Update Developer Guide
Browse files Browse the repository at this point in the history
  • Loading branch information
seraphimstreets committed Nov 13, 2023
1 parent 3bf4eca commit 02f9444
Show file tree
Hide file tree
Showing 4 changed files with 103 additions and 3 deletions.
21 changes: 19 additions & 2 deletions docs/DeveloperGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ Below is an activity diagram that demonstrates how this command works.

### Add Graded Component

<puml src="diagrams/AddGradedComponentSequenceDiagram.puml" width="450" />
<puml src="diagrams/AddGradedComponentSequenceDiagram.puml" width="1000" />

The `addComp` command allows users to add a graded component and automaticaly create student scores associated with that component for every student in the database.
A typical program flow is as follows:
Expand Down Expand Up @@ -259,7 +259,7 @@ Alternative Implementations:

### Edit Graded Component

<puml src="diagrams/EditGradedComponent.puml" width="450" />
<puml src="diagrams/EditGradedComponent.puml" width="1000" />

The `editComp` command allows users to edit a graded component's details based on its 1-based index, which are propagated to the component's associated student scores.
A typical program flow is as follows:
Expand All @@ -285,6 +285,23 @@ Alternative Implementations:
create some inefficiency as the `Model` has to search through the entire `GradedComponent` list
for the appropriate item to replace. Therefore, this is a possible extension that future developers may consider.

### Delete Graded Component

<puml src="diagrams/DeleteGradedComponentSequenceDiagram.puml" width="1000" />

The `deleteComp` command allows users to delete a graded component alongside its associated student scores based on its 1-based index.
A typical program flow is as follows:

1. User enters a command to delete a graded component, for instance `deleteComp 2`.
2. `DeleteGradedComponentCommandParser` checks that the only argument provided is a valid index, which is an integer between 1 and the size of the displayed `GradedComponent` list.
3. Index is passed into `DeleteGradedComponentCommand`'s constructor which is then executed.
4. The graded component corresponding to the index in the currently displayed `GradedComponentBook` list is removed.
5. All associated student scores of that `GradedComponent` are also removed.

Alternative Implementations:
* We originally considered having users remove graded components based on their unique component name. Ultimately, we decided it would be faster for users to type in an index rather than a name (especially if it is quite lengthy),
although future developers may want to extend this functionality so that users can choose to remove by either index or component name.

### Sort Commands

The Sort related features allows NUS professors to sort the currently displayed students or student scores. When successfully executed, the sorted students or student scores will be shown on the Graphical User Interface. <br>
Expand Down
80 changes: 80 additions & 0 deletions docs/diagrams/DeleteGradedComponentSequenceDiagram.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
@startuml
!include style.puml
skinparam ArrowFontStyle plain

box Logic LOGIC_COLOR_T1
participant ":LogicManager" as LogicManager LOGIC_COLOR
participant ":ModuLightParser" as ModuLightParser LOGIC_COLOR
participant ":DeleteGradedComponentCommandParser" as DeleteGradedComponentCommandParser LOGIC_COLOR
participant ":DeleteGradedComponentCommand" as DeleteGradedComponentCommand LOGIC_COLOR
participant ":CommandResult" as CommandResult LOGIC_COLOR
end box

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

[-> LogicManager : execute("deleteComp 1")
activate LogicManager

LogicManager -> ModuLightParser : parseCommand("deleteComp 1")
activate ModuLightParser

create DeleteGradedComponentCommandParser
ModuLightParser -> DeleteGradedComponentCommandParser
activate DeleteGradedComponentCommandParser

DeleteGradedComponentCommandParser --> ModuLightParser
deactivate DeleteGradedComponentCommandParser

ModuLightParser -> DeleteGradedComponentCommandParser : parse(arguments)
activate DeleteGradedComponentCommandParser


create DeleteGradedComponentCommand
DeleteGradedComponentCommandParser -> DeleteGradedComponentCommand : new DeleteGradedComponentCommand(index)
activate DeleteGradedComponentCommand

DeleteGradedComponentCommand --> DeleteGradedComponentCommandParser
deactivate DeleteGradedComponentCommand

DeleteGradedComponentCommandParser --> ModuLightParser
deactivate DeleteGradedComponentCommandParser
'Hidden arrow to position the destroy marker below the end of the activation bar.
DeleteGradedComponentCommandParser -[hidden]-> ModuLightParser
destroy DeleteGradedComponentCommandParser

ModuLightParser --> LogicManager
deactivate ModuLightParser

LogicManager -> DeleteGradedComponentCommand : execute()
activate DeleteGradedComponentCommand

DeleteGradedComponentCommand -> Model : removeGradedComponent(gc)
activate Model

Model --> DeleteGradedComponentCommand
deactivate Model

loop for all associated studentScores of gc
DeleteGradedComponentCommand -> Model :removeStudentScore(studentScore)
activate Model

Model --> DeleteGradedComponentCommand
deactivate Model
end


create CommandResult
DeleteGradedComponentCommand -> CommandResult
activate CommandResult

CommandResult --> DeleteGradedComponentCommand
deactivate CommandResult

DeleteGradedComponentCommand --> LogicManager : result
deactivate DeleteGradedComponentCommand

[<--LogicManager
deactivate LogicManager
@enduml
1 change: 1 addition & 0 deletions docs/team/seraphimstreets.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,3 +81,4 @@ Format: `deleteComp INDEX`
Examples: `deleteComp 2` deletes the second graded component in the displayed Graded Components List

### Contributions to Developer Guide

4 changes: 3 additions & 1 deletion src/main/java/seedu/modulight/model/student/Student.java
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,9 @@ private float calcTotalScore() {
GradedComponent gc = sc.getGradedComponent();
Weightage w = gc.getWeightage();
float weight = w.weightage;
totalScore += weight / totalWeightage * sc.calcRelativeScore();
if (totalWeightage != 0) {
totalScore += weight / totalWeightage * sc.calcRelativeScore();
}
}
return totalScore;
}
Expand Down

0 comments on commit 02f9444

Please sign in to comment.