Skip to content

Commit

Permalink
Merge pull request AY2425S1-CS2103T-F11-2#149 from Rachelcoll/documents
Browse files Browse the repository at this point in the history
Update UG and DG implementation for `attendance` `mark` and `unmark` command
  • Loading branch information
shizy authored Nov 6, 2024
2 parents 88da46f + b3ff363 commit 317129b
Show file tree
Hide file tree
Showing 18 changed files with 321 additions and 157 deletions.
161 changes: 95 additions & 66 deletions docs/DeveloperGuide.md

Large diffs are not rendered by default.

67 changes: 67 additions & 0 deletions docs/UserGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,70 @@ Examples:
* `list` followed by `delete 2` deletes the 2nd person in the address book.
* `find Betsy` followed by `delete 1` deletes the 1st person in the results of the `find` command.

### Listing all members for attendance : `attendance`

Lists all contacts that have the role “Member” in the address book, making it easier to check and mark attendance for them directly.

Format: `attendance` or `atd` (alias)

* The command must be in lowercase. Variations (e.g., capitalized or mixed-case) will not be recognized.
* This command does not take any additional parameters. If any extra input is provided, an error message will be displayed.


![result for 'attendance'](images/ListAttendanceResult.png)

### Marking attendance : `mark`

Marks attendance for **members** with specified Telegram handles on a specific date.


Format: `mark t/TELEGRAM1 [t/TELEGRAM2] [...] d/DATE`

Alternative Format: `m t/TELEGRAM1 [t/TELEGRAM2] [...] d/DATE`

* Each Telegram handle must begin with t/, followed by an alphanumeric or _ string with no spaces, e.g., t/berniceyu123.
* The command is not case-sensitive (e.g., t/alexyeoh is the same as t/ALEXYEOH) except command keyword `mark` itself.
* The command does not allow spaces between the prefix t/ or d/ and the argument.

Command Parameters:
- Telegram Handles (`t/telegram`):
* Accepts multiple handles separated by spaces, each beginning with t/.
* Handles must be alphanumeric or include _ (e.g., t/alex_yeoh123).
* Invalid input: Spaces within or after the prefix (e.g., t/ alexyeoh) result in an error.
* Telegram handle should belong to a contact with `Member` role.

- Date (`d/date`)
* Takes in one string value with format d/YYYY-MM-DD (eg. d/2024-01-22 not d/2024/1/22)
* Only accept one date, if multiple dates are input, only the last one will be recorded as the attendance date.
* Date must not be later than current date (eg. 2090-11-02 is an invalid datetime)

Examples:

* `mark t/toom t/maary d/2024-11-02`

![result of command `mark t/toom t/maary d/2024-11-02`](images/MarkCommandResult.png)

* Mark attendance of contact with telegram `toom` first, then input command `mark t/toom t/maary d/2024-11-02`

![img_3.png](images/RepeatedMarkCommandResult.png)

* Mark attendance of a non-member contact `mark t/jerry d/2024-11-02`

![result of command `mark t/jerry d/2024-11-02`](images/MarkNonMemberCommandResult.png)


### Unmarking attendance : `unmark`

Unmarks attendance for **members** with specified Telegram handles on a specific date.


Format: `unmark t/TELEGRAM1 [t/TELEGRAM2] [...] d/DATE`

Alternative Format: `um t/TELEGRAM1 [t/TELEGRAM2] [...] d/DATE`

* All parameter constraints and error messages are the same as `mark` command, except `mark` is replaced by `unmark`


### Clearing all entries : `clear`

Clears all entries from the address book.
Expand Down Expand Up @@ -206,3 +270,6 @@ Action | Format, Examples
**Find** | `find KEYWORD [MORE_KEYWORDS]`<br> e.g., `find James Jake`
**List** | `list`
**Help** | `help`
**Attendance** | `attendance` or `atd`
**Mark Attendance** | `mark t/TELEGRAM1 [t/TELEGRAM2] [...] d/DATE` or `m t/TELEGRAM1 [t/TELEGRAM2] [...] d/DATE` <br> e.g., `mark t/berniceYu t/alexYeoh d/2024-11-02`
**Unmark Attendance** | `unmark t/TELEGRAM1 [t/TELEGRAM2] [...] d/DATE` or `um t/TELEGRAM1 [t/TELEGRAM2] [...] d/DATE`
20 changes: 20 additions & 0 deletions docs/diagrams/MarkAttendanceActivityDiagram.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
@startuml
skin rose
skinparam ActivityFontSize 15
skinparam ArrowFontSize 12
start
:User inputs telegram handles and date to mark attendance
:User executes command;

'Since the beta syntax does not support placing the condition outside the
'diamond we place it as the true branch instead.

if () then ([user input is valid])
:Get list of Members from filteredPersonList of model;
:Create copy of existing member
Add attendance of the specified date to each member;
:Update corresponding members in address book;
else ([else])
endif
stop
@enduml
50 changes: 50 additions & 0 deletions docs/diagrams/MarkAttendanceCommandClassDiagram.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
@startuml
!include style.puml
skinparam ClassFontColor #000000
skinparam ClassBorderColor #000000
skinparam ClassBackgroundColor #FFFFAA

' Class Diagram for MarkAttendance Feature

class AddressBook {
- FilteredList<Person> filteredPersons
+ void setPerson(Person target, Person updatedPerson)
+ FilteredList<Person> getFilteredPersonList()
}

class Model

class Person {
+ boolean isMember()
}

class Attendance {
- LocalDate session
}

class Role

class Member

class AttendanceMarkingCommand {
+ List<String> displayMembers()
}

class MarkAttendanceCommand {
- List<Telegram> telegrams
- Attendance attendance
+ CommandResult execute(Model model) throws CommandException
}


' Relationships
AttendanceMarkingCommand .right.|> Command
MarkAttendanceCommand .up.|> AttendanceMarkingCommand
ModelManager .left.|> Model
ModelManager o-- AddressBook
AddressBook o-left- Person
MarkAttendanceCommand -right-> Model : uses
Member .right.|> Role
Person -left-> "*" Role : contains
Person --> "*" Attendance : contains
@enduml
64 changes: 64 additions & 0 deletions docs/diagrams/MarkAttendanceSequenceDiagram-Logic.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
@startuml
!include style.puml
skinparam ArrowFontStyle plain

box Logic LOGIC_COLOR_T1
participant ":LogicManager" as LogicManager LOGIC_COLOR
participant ":AddressBookParser" as AddressBookParser LOGIC_COLOR
participant ":MarkAttendanceCommandParser" as MarkAttendanceCommandParser LOGIC_COLOR
participant "m:MarkAttendanceCommand" as MarkAttendanceCommand LOGIC_COLOR
end box

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

LogicManager -> AddressBookParser : parseCommand(mark)
activate AddressBookParser

create MarkAttendanceCommandParser
AddressBookParser -> MarkAttendanceCommandParser
activate MarkAttendanceCommandParser

create MarkAttendanceCommand
MarkAttendanceCommandParser -> MarkAttendanceCommand : parse(arguments)
activate MarkAttendanceCommand

MarkAttendanceCommand --> MarkAttendanceCommandParser : m
deactivate MarkAttendanceCommand

MarkAttendanceCommandParser --> AddressBookParser
deactivate MarkAttendanceCommandParser

AddressBookParser --> LogicManager : m
deactivate AddressBookParser

LogicManager -> MarkAttendanceCommand : execute()
activate MarkAttendanceCommand

MarkAttendanceCommand -> Model : getFilteredPersonList()
activate Model

Model --> MarkAttendanceCommand : filteredPersonList
deactivate Model

MarkAttendanceCommand -> MarkAttendanceCommand : markAttendance()
activate MarkAttendanceCommand

MarkAttendanceCommand -> Model : setPerson()
activate Model

MarkAttendanceCommand -> MarkAttendanceCommand : findByTelegram()
activate MarkAttendanceCommand

MarkAttendanceCommand --> LogicManager : result
deactivate MarkAttendanceCommand

MarkAttendanceCommand -[hidden]-> LogicManager : result
destroy MarkAttendanceCommand

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

box Model MODEL_COLOR_T1
participant ":Model" as Model MODEL_COLOR
participant ":AddressBook" as AddressBook MODEL_COLOR
participant "persons:UniquePersonList" as UniquePersonList MODEL_COLOR
end box

[-> Model : setPerson(p)
activate Model

Model -> AddressBook : setPerson(p)
activate AddressBook

AddressBook -> UniquePersonList : contains(p)
AddressBook --> Model
deactivate AddressBook

[<-- Model
deactivate Model

@enduml
21 changes: 0 additions & 21 deletions docs/diagrams/UndoRedoState0.puml

This file was deleted.

46 changes: 0 additions & 46 deletions docs/diagrams/UndoSequenceDiagram-Logic.puml

This file was deleted.

23 changes: 0 additions & 23 deletions docs/diagrams/UndoSequenceDiagram-Model.puml

This file was deleted.

2 changes: 1 addition & 1 deletion docs/diagrams/style.puml
Original file line number Diff line number Diff line change
Expand Up @@ -75,5 +75,5 @@ skinparam DefaultTextAlignment center
skinparam packageStyle Rectangle

hide footbox
hide members
hide empty members
hide circle
Binary file added docs/images/ListAttendanceResult.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/MarkAttendanceActivityDiagram.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/MarkAttendanceCommandClassDiagram.png
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.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/MarkCommandResult.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/MarkNonMemberCommandResult.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/RepeatedMarkCommandResult.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 317129b

Please sign in to comment.