Skip to content

Commit

Permalink
Complete DG
Browse files Browse the repository at this point in the history
  • Loading branch information
yyyaohhh committed Nov 13, 2023
1 parent 000f1cb commit bf8370a
Show file tree
Hide file tree
Showing 4 changed files with 155 additions and 5 deletions.
50 changes: 46 additions & 4 deletions docs/DeveloperGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ This section describes some noteworthy details on how certain features and comma
* [Edit Module Command](#edit-module-command)
* [Delete Module Command](#delete-module-command)
* [Calculate CAP Command](#calculate-cap-command)
* [Calculate Modular Credits (MC) Command](#calculate-modular-credits-mc-command)
* [Calculate Modular Credits (MCs) Command](#calculate-modular-credits-mcs-command)
* [Undo/redo feature](#proposed-undoredo-feature)

<br>
Expand Down Expand Up @@ -335,17 +335,59 @@ The following sequence diagram shows how the `delete` command works:

### Calculate CAP Command

**Overview:**<br>

The `calculateCAP` command is used to calculate the Cumulative Average Point (CAP) of all valid modules in the module planner, using their grades and modular credits. <br>

The format of the `calculateCAP` command can be found [here](https://ay2324s1-cs2103t-t13-0.github.io/tp/UserGuide.html#calculating-the-total-current-cap-calculatecap).<br>

**Feature details:**<br>

1. The user executes the `calculateCAP` command.
2. If the previous step is completed without exceptions, the CAP will be calculated and displayed.

<br>

The sequence of the `calculateCAP` command is as follows:<br>

1. The user inputs the `calculateCAP` command.<br>
2. The `LogicManager` calls the `ModulePlanParser#parseCommand` to parse the command.
3. The `ModulePlanParser` then creates a new `CalculateCapCommand`.
4. The `CalculateCapCommand` calculates the CAP by calling `Model#getCap`.

The following sequence diagram shows how the `calculateCAP` command works:

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

<br>

### Implementation
### Calculate Modular Credits (MCs) Command

**Overview:**<br>

The `calculateMC` command is used to calculate the total sum of Modular Credits (MCs) of all modules in the module planner, regardless of their grades. <br>

The format of the `calculateMC` command can be found [here](https://ay2324s1-cs2103t-t13-0.github.io/tp/UserGuide.html#calculating-the-total-current-modular-credits-mcs-calculatemc).<br>

### Calculate Modular Credits (MC) Command
**Feature details:**<br>

1. The user executes the `calculateMC` command.
2. If the previous step is completed without exceptions, the number of MCs will be calculated and displayed.

<br>

### Implementation
The sequence of the `calculateMC` command is as follows:<br>

1. The user inputs the `calculateMC` command.<br>
2. The `LogicManager` calls the `ModulePlanParser#parseCommand` to parse the command.
3. The `ModulePlanParser` then creates a new `CalculateMcCommand`.
4. The `CalculateMcCommand` calculates the CAP by calling `Model#totalModularCredits`.

The following sequence diagram shows how the `calculateMC` command works:

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

<br>

### \[Proposed\] Undo/redo feature

Expand Down
54 changes: 54 additions & 0 deletions docs/diagrams/CalculateCapSequenceDiagram.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
@startuml
!include style.puml
skinparam ArrowFontStyle plain

box Logic LOGIC_COLOR_T1
participant ":LogicManager" as LogicManager LOGIC_COLOR
participant ":ModulePlanParser" as ModulePlanParser LOGIC_COLOR
participant "c:CalculateCapCommand" as CalculateCapCommand LOGIC_COLOR
participant "result:CommandResult" as CommandResult LOGIC_COLOR
end box

box Model MODEL_COLOR_T1
participant "model:Model" as Model MODEL_COLOR
end box
[-> LogicManager : execute(calculateCAP)
activate LogicManager

LogicManager -> ModulePlanParser : parseCommand(calculateCAP)
activate ModulePlanParser

create CalculateCapCommand
ModulePlanParser -> CalculateCapCommand
activate CalculateCapCommand

CalculateCapCommand --> ModulePlanParser
deactivate CalculateCapCommand

ModulePlanParser --> LogicManager : c
deactivate ModulePlanParser

LogicManager -> CalculateCapCommand : execute(model)
activate CalculateCapCommand

CalculateCapCommand -> Model : getCap()
activate Model

Model --> CalculateCapCommand : calculatedCapValue
deactivate Model

create CommandResult
CalculateCapCommand -> CommandResult
activate CommandResult

CommandResult --> CalculateCapCommand
deactivate CommandResult

CalculateCapCommand --> LogicManager : result
deactivate CalculateCapCommand
CalculateCapCommand -[hidden]-> LogicManager : result
destroy CalculateCapCommand

[<--LogicManager : result
deactivate LogicManager
@enduml
54 changes: 54 additions & 0 deletions docs/diagrams/CalculateMcSequenceDiagram.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
@startuml
!include style.puml
skinparam ArrowFontStyle plain

box Logic LOGIC_COLOR_T1
participant ":LogicManager" as LogicManager LOGIC_COLOR
participant ":ModulePlanParser" as ModulePlanParser LOGIC_COLOR
participant "c:CalculateMcCommand" as CalculateMcCommand LOGIC_COLOR
participant "result:CommandResult" as CommandResult LOGIC_COLOR
end box

box Model MODEL_COLOR_T1
participant "model:Model" as Model MODEL_COLOR
end box
[-> LogicManager : execute(calculateMC)
activate LogicManager

LogicManager -> ModulePlanParser : parseCommand(calculateMC)
activate ModulePlanParser

create CalculateMcCommand
ModulePlanParser -> CalculateMcCommand
activate CalculateMcCommand

CalculateMcCommand --> ModulePlanParser
deactivate CalculateMcCommand

ModulePlanParser --> LogicManager : c
deactivate ModulePlanParser

LogicManager -> CalculateMcCommand : execute(model)
activate CalculateMcCommand

CalculateMcCommand -> Model : totalModularCredits()
activate Model

Model --> CalculateMcCommand : modularCredits
deactivate Model

create CommandResult
CalculateMcCommand -> CommandResult
activate CommandResult

CommandResult --> CalculateMcCommand
deactivate CommandResult

CalculateMcCommand --> LogicManager : result
deactivate CalculateMcCommand
CalculateMcCommand -[hidden]-> LogicManager : result
destroy CalculateMcCommand

[<--LogicManager : result
deactivate LogicManager
@enduml
2 changes: 1 addition & 1 deletion docs/diagrams/DeleteCommandActivityDiagram.puml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ skinparam ActivityFontSize 15
skinparam ArrowFontSize 12
!pragma useVerticalIf on
start
:User executes delete module command;
:User executes delete command;
:Parse command string;

if () then ([else])
Expand Down

0 comments on commit bf8370a

Please sign in to comment.