Skip to content

Commit

Permalink
update dg for delete appointments recursively
Browse files Browse the repository at this point in the history
  • Loading branch information
Kappaccinoh committed Mar 28, 2024
1 parent 5cb34ac commit da795c2
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
9 changes: 6 additions & 3 deletions docs/DeveloperGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -232,13 +232,16 @@ The activity diagram below demonstrates this error handling process in more deta
* Step 4. The `parse` command in `deleteCommandParser` return an instance of `deleteCommand`.
* Step 5. The `LogicManager` calls the `execute` method in `deleteCommand`.
* Step 6. The `execute` method in `deleteCommand` executes and calls `deletePerson` in model to remove doctor or patient from the system.
* Step 7. Success message gets printed onto the results display to notify user.

* Step 7. The `execute` method in `deleteCommand` also iterates through the `ObservableList<Appointments>` and retrieves all appointments that have the person to be deleted, and calls the `deleteAppointmentCommand` as well.
* Step 8. Success message gets printed onto the results display to notify user.

Why is this implemented this way?
1. Making both `Doctor` and `Patient` class extend the `Person` class makes it easier to execute delete operations.
2. `Doctor` and `Patient` all exhibit similar qualities, and thus can inherit from the `Person` superclass.
3. Eliminates the need for seperate delete commands for doctor and patient.
3. Eliminates the need for separate delete commands for doctor and patient.
4. Since appointments are constructed with unique `Person` `Nric` fields, it does not make sense to have an appointment that does not have valid doctor or patient entries.
5. As such, the solution that is inbuilt to deleting a `Person`, comes with the added functionality on the backend to delete all related `Appointment` entries as well.
6. This results in a cleaner `Appointments` panel, and saves the user from the hassle of needing to delete unwanted `Appointment` entries one by one.

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

Expand Down
4 changes: 2 additions & 2 deletions docs/diagrams/DeletePersonActivityDiagram.puml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ else ([else])
if () then ([Invalid person index detected])
:Show error message\nindicating invalid Person index;
else ([else])
:Remove patient/doctor\nfrom the persons list;
:Update the 'person' panel\nin the GUI;
:Remove patient/doctor\nfrom the persons list\nalso removes any appointments\nassociated with the deleted patient/doctor;
:Update the 'person' panel\nand appointments panel\n in the GUI;
:Show success message\nwith removed doctor/patient information;
endif;
endif
Expand Down
Binary file modified docs/images/DeletePersonActivityDiagram.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 da795c2

Please sign in to comment.