From adac99d189b106a01ab7bb17686c50b3c3c00305 Mon Sep 17 00:00:00 2001 From: jayne1010 Date: Sun, 14 Apr 2024 23:08:09 +0800 Subject: [PATCH] Fix bug --- docs/DeveloperGuide.md | 14 ++++++++++---- docs/diagrams/ShowSequenceDiagram.puml | 6 ++++++ 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/docs/DeveloperGuide.md b/docs/DeveloperGuide.md index fda9ff509a6..ba87044558a 100644 --- a/docs/DeveloperGuide.md +++ b/docs/DeveloperGuide.md @@ -392,11 +392,13 @@ These operations are exposed in the `Model` interface as `Model#setPerson(Person The `edit` feature has the following operations in `ModelManager` which implements the `Model` interface: -- Model#setPerson: Replaces the given person target with `editedPerson`. Target must exist in the address book. The person identity of `editedPerson` must not be the same as another existing person in the address book. +- `Model#getPersonIfExists(predicate)` - returns the specified person if they exist in the list. -- Model#hasPerson: Returns true if a person with the same identity as person exists in the address book. +- `Model#setPerson`: Replaces the given person target with `editedPerson`. Target must exist in the address book. The person identity of `editedPerson` must not be the same as another existing person in the address book. -- Model#updateFilteredPersonList: Updates the filter of the filtered person list to filter by the given predicate. +- `Model#hasPerson`: Returns true if a person with the same identity as person exists in the address book. + +- `Model#updateFilteredPersonList`: Updates the filter of the filtered person list to filter by the given predicate. Given below is an example usage scenario and how the edit note mechanism behaves at each step. @@ -441,6 +443,8 @@ The following activity diagram summarizes what happens when a user executes a ne #### Implementation The `show` mechanism is facilitated by `ModelManager`. It implements + +- `ModelManager#getPersonIfExists(predicate)` - returns the specified person if they exist in the list. - `ModelManager#setDisplayNote(Person person)` - which allows users to display the notes of selected contacts on the `NoteDisplay`. - `ModelManager#clear()` - which clears the notes in `NoteDislay`. @@ -455,7 +459,9 @@ Step 1: The user launches the application. The `AddressBook` will be initialized Step 2: - Scenario 1: The user executes `show T0123456A ...` to show the notes of the person in the address book with the unique IC number of `T0123456A`. -The `show` command calls `ModelManager#setDisplayNote(Person person)`, causing the modified state of the address book after the `show T0123456A ...` command executes to be displayed. +The `show` command calls `ModelManager#getPersonIfExists(predicate)` to check if the specific person exists in the addressbook. + +- `ModelManager#setDisplayNote(Person person)` is then called, causing the modified state of the address book after the `show T0123456A ...` command executes to be displayed. - Scenario 2: The user executes `show` to clear the notes of the person in patient notes display of the address book. The `show` command calls `ModelManager#clear()`, causing the modified state of the address book after the `show` command executes to be displayed. diff --git a/docs/diagrams/ShowSequenceDiagram.puml b/docs/diagrams/ShowSequenceDiagram.puml index fed943d9bbe..81d08a3e6b5 100644 --- a/docs/diagrams/ShowSequenceDiagram.puml +++ b/docs/diagrams/ShowSequenceDiagram.puml @@ -49,6 +49,12 @@ deactivate AddressBookParser LogicManager -> ShowCommand : execute(m) activate ShowCommand +ShowCommand -> Model : getPersonIfExists(predicate) +activate Model + +Model --> ShowCommand +deactivate Model + ShowCommand -> Model : setDisplayNote(T0123456A) activate Model