Skip to content

Commit

Permalink
Merge pull request #316 from pkwangjoo/branch-ldhc-llbd-dg-diagrams
Browse files Browse the repository at this point in the history
Branch ldhc llbd dg diagrams
  • Loading branch information
kennethk-1201 authored Apr 10, 2023
2 parents 00b3e81 + 5827765 commit 510f87c
Show file tree
Hide file tree
Showing 6 changed files with 145 additions and 1 deletion.
21 changes: 21 additions & 0 deletions docs/DeveloperGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -545,6 +545,27 @@ Sequence Diagram:

After that, the command result is returned.

#### 4.3.7. Listing department headcount

The `ldhc command`

Activity Diagram:

![ListDepartmentHeadcountCommand](./images/commands/department/ListDepartmentHeadcountActivityDiagram.png)

Sequence Diagram:

![ListDepartmentHeadcountCommand](./images/commands/department/ListDepartmentHeadcountSequenceDiagram.png)

##### Flow
1. The user enters the command, e.g. `ldhc d/2023-04-10 n/Human Resources` to list the department headcount for Human Resources department
on the given date of 2023 April 10.
2. The parser instantiates a new `DepartmentName` object constructed from the argument prefixed by `n/` and checks that the date prefixed by `d/` is valid.
3. `ListDepartmentHeadcountCommand` object is returned and when executed, it gets the department with the `DepartmentName` object created in step 2.
4. It creates a new `LeaveDate` object with the valid date prefixed by `d/` and gets a `Leave` associated with `LeaveDate` object.
5. `FilteredDepartmentList` is updated to show the department with `departmentName` and the `FilteredEmployeeList` is updated to reflect the employees that are not in the
`Leave` object and in the `Department` object.


### 4.4. Leave-related features
The `Leave` object represents a leave date in the company. They are all stored in a `UniqueLeaveList`.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
@startuml
!pragma useVerticalIf on
start
:User enters ldhc command;
if () then ([else])
:Error: Invalid command format;
([Command format is valid])elseif () then ([else])
:Error: Department does not exist in SudoHR;
([Department exists in SudoHr]) elseif () then ([else]))
: Error: Invalid date;
else ([Date is not given or given date is valid])
:ldhc command successfully executes.;
endif
stop

@enduml
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
@startuml
!include ../../style.puml

box Logic LOGIC_COLOR_T1
participant ":LogicManager" as LogicManager LOGIC_COLOR
participant ":SudoHrParser" as SudoHrParser LOGIC_COLOR
participant ":ListDepartmentHeadcountCommandParser" as ListDepartmentHeadcountCommandParser LOGIC_COLOR
participant ":ListDepartmentHeadcountCommand" as ListDepartmentHeadcountCommand LOGIC_COLOR
participant "departmentName:DepartmentName" as DepartmentName LOGIC_COLOR
participant "leaveDate:LeaveDate" as LeaveDate LOGIC_COLOR
participant ":CommandResult" as CommandResult LOGIC_COLOR
end box

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

[-> LogicManager : execute("ldhc d/2023-04-10 n/Human Resources")
activate LogicManager

LogicManager -> SudoHrParser : parseCommand("ldhc d/2023-04-10 n/Human Resources")
activate SudoHrParser

create ListDepartmentHeadcountCommandParser
SudoHrParser -> ListDepartmentHeadcountCommandParser
activate ListDepartmentHeadcountCommandParser

ListDepartmentHeadcountCommandParser --> SudoHrParser
deactivate ListDepartmentHeadcountCommandParser

SudoHrParser -> ListDepartmentHeadcountCommandParser: parse("d/2023-04-10 n/Human Resources")
activate ListDepartmentHeadcountCommandParser

create DepartmentName
ListDepartmentHeadcountCommandParser -> DepartmentName
activate DepartmentName

DepartmentName --> ListDepartmentHeadcountCommandParser
deactivate DepartmentName

create ListDepartmentHeadcountCommand
ListDepartmentHeadcountCommandParser -> ListDepartmentHeadcountCommand
activate ListDepartmentHeadcountCommand

ListDepartmentHeadcountCommand --> ListDepartmentHeadcountCommandParser
deactivate ListDepartmentHeadcountCommand

ListDepartmentHeadcountCommandParser --> SudoHrParser
deactivate ListDepartmentHeadcountCommandParser

ListDepartmentHeadcountCommandParser -[hidden]-> SudoHrParser
destroy ListDepartmentHeadcountCommandParser

SudoHrParser --> LogicManager
deactivate SudoHrParser

LogicManager -> ListDepartmentHeadcountCommand : execute(model)
activate ListDepartmentHeadcountCommand

ListDepartmentHeadcountCommand -> Model : getDepartment(departmentName)
activate Model

Model --> ListDepartmentHeadcountCommand
deactivate Model

create LeaveDate
ListDepartmentHeadcountCommand -> LeaveDate
activate LeaveDate

LeaveDate --> ListDepartmentHeadcountCommand
deactivate LeaveDate

ListDepartmentHeadcountCommand -> Model: getLeave(leaveDate)
activate Model

Model --> ListDepartmentHeadcountCommand
deactivate Model


ListDepartmentHeadcountCommand -> Model : updateFilteredDepartmentList
activate Model

Model --> ListDepartmentHeadcountCommand
deactivate Model

ListDepartmentHeadcountCommand -> Model: updateFilteredEmployeeList
activate Model

Model --> ListDepartmentHeadcountCommand
deactivate Model



create CommandResult
ListDepartmentHeadcountCommand -> CommandResult
activate CommandResult

CommandResult --> ListDepartmentHeadcountCommand
deactivate CommandResult

ListDepartmentHeadcountCommand --> LogicManager : result
deactivate ListDepartmentHeadcountCommand

[<--LogicManager
deactivate LogicManager
@enduml
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 2 additions & 1 deletion docs/team/pkwangjoo.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ Given below are my contributions to the project.
- User Guide:
- Contributed to explaining about the ListDepartmentHeadcountCommand.
- Developer Guide:
- Contributed to writing UML diagrams for ListDepartmentHeadcountCommand.
- Contributed to drawing UML diagrams for ListDepartmentHeadcountCommand.
- Write use cases and stories for features.

- **Code Quality and Bug Fixing**:
- Ensured good code quality and spotted bugs in PRs reviewed.
Expand Down

0 comments on commit 510f87c

Please sign in to comment.