Skip to content

Commit

Permalink
Update DG's ListAppointmentCommand
Browse files Browse the repository at this point in the history
  • Loading branch information
Kim Shi Tong committed Nov 14, 2023
1 parent 2e91911 commit d2a647f
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions docs/DeveloperGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -303,12 +303,11 @@ Given below is an example usage scenario and how the `ListAppointmentCommand` me
* The `list_a` command triggers `MediConnectParser#parseCommand(String)`, which identifies the command word and calls `ListAppointmentCommandParser#parse(String)` to handle the arguments.

**Step 2**: The `ListAppointmentCommandParser#parse(String)` method checks for the presence of optional flags like `dic\` for doctor NRIC and `pic\` for patient NRIC.
* Based on the presence of the doctor/patient NRIC flags, it will affect whether their predicate `AppointmentEqualDoctorNricPredicate`/`AppointmentEqualPatientNricPredicate` is `PREDICATE_SHOW_ALL_DOCTORS`/`PREDICATE_SHOW_ALL_PATIENTS` or the predicate of the specified doctor/patient's NRIC.
* A new `ListAppointmentCommand` instance is created using the `AppointmentFilterByNricPredicate` that is constructed with `AppointmentEqualDoctorNricPredicate` and `AppointmentEqualPatientNricPredicate`.
* A new `ListAppointmentCommand` instance is then created with the predicate `AppointmentFilterByNricPredicate`.

**Step 3**: The created `ListAppointmentCommand` instance is returned to `LogicManager`, and its execute method is called.
* `ListAppointmentCommand#execute(Model)` then calls `Model#updateFilteredAppointmentList(Predicate<Appointment>)` with the predicate `AppointmentFilterByNricPredicate`.
* The `FilteredAppointmentList` is updated to show all doctors by calling `Model#setPredicate(Predicate<Appointment>)`.
* `ListAppointmentCommand#execute(Model)` then calls `Model#updateFilteredAppointmentList(Predicate)` with the predicate `AppointmentFilterByNricPredicate`.
* The `FilteredAppointmentList` is updated to show all doctors by calling `Model#updateFilteredAppointmentList(Predicate<Appointment>)`.

**Step 4**: A `CommandResult` object is created with a message indicating success, and this result is returned to the UI to be displayed to the user.

Expand Down

0 comments on commit d2a647f

Please sign in to comment.