Skip to content

Commit

Permalink
Merge branch 'master' into branch-code-slap
Browse files Browse the repository at this point in the history
nikele2001 authored Nov 11, 2023
2 parents eaac7d9 + ed176dc commit 4c6aac4
Showing 17 changed files with 123 additions and 79 deletions.
69 changes: 38 additions & 31 deletions docs/DeveloperGuide.md
Original file line number Diff line number Diff line change
@@ -187,11 +187,11 @@ Classes used by multiple components are in the `seedu.addressbook.commons` packa

This section describes some noteworthy details on how certain features are implemented.

### Overview
### Overview

The basic idea of what happens when a user types a command:
The basic idea of what happens when a user types a command:
1. The LogicManager executes method is called and takes in the user's input.
2. The user's input is then parsed by `AddressBookParser`, which then creates the respective `XYZCommandParser`.
2. The user's input is then parsed by `AddressBookParser`, which then creates the respective `XYZCommandParser`.
3. `XYZCommandParser` parses the additional arguments provided by the user and creates and `XYZCommand`.
4. `XYZCommand` then communicates with ModelManager to execute and returns a `CommandResult` which is displayed to the user.

@@ -208,39 +208,37 @@ of schedule command is then returned. The partial class diagram is shown below.

<img src="images/ScheduleClassDiagram.png" width="400"/>

The following activity diagram summarises what happens the user executes a schedule command.
The following activity diagram summarises what happens the user executes a schedule command.

<img src="images/ScheduleActivityDiagram.png" width="400"/>

**Design Considerations**

**Aspect: How to implement Appointments for Person**
**Aspect: How to implement Appointments for Person**

Alternative 1 (Current Choice): Create an abstract class ScheduleItem and make it a compulsory field for Person.

The diagram below illustrates our current implementation. A `Person` has is associated with 1 `ScheduleItem`, which can
be a `NullAppointment`(empty appointment) or `Appointment`.
The diagram below illustrates our current implementation. A `Person` has is associated with 1 `ScheduleItem`, which can be a `NullAppointment`(empty appointment) or `Appointment`.

<img src="images/ScheduleItemClassDiagram.png" width="300"/>
<img src="images/ScheduleItemClassDiagram.png" width="300"/>

- Pros:
- Pros:
* This ensures a 1-to-1 relationship between Person and Appointment, making implementation of other functions like
sort easier. This also prevents clutter of appointments in the UI.
* This makes use of a **facade** design pattern, where `NullAppointment` and `Appointment` will handle themselves
without the `Person` knowing.
- Cons:
without the `Person` knowing.

- Cons:
* This makes the scheduling of Appointments more inflexible, as the FA is unable to schedule multiple appointments
with the same person.

- Other considerations:
* `NullAppointment` is a Singleton class to prevent multiple instances of it being created, making it more efficient
for memory.
- Other considerations:
* `NullAppointment` is a Singleton class to prevent multiple instances of it being created, making it more efficient for memory.

Alternative 2: Create a hashset of Appointments for each Person.
Alternative 2: Create a hashset of Appointments for each Person.
- Pros:
* More flexible, user can now schedule multiple appointment for a Person.
* More flexible, user can now schedule multiple appointment for a Person.

- Cons:
* Harder to implement operations such as editing of an appointment for a client. An additional step of finding the
specified appointment within the hashset is required, which may potentially introduce more bugs.
@@ -252,13 +250,13 @@ The **Complete** feature is facilitated by the `CompleteCommand` and `CompleteCo
`CompleteCommandParser` creates a `CompleteCommand` associated with a `CompleteCommandDescriptor` which contains
information on how the appointments should be completed.

The following sequence diagram illustrates how the complete operation is executed when date given.
The following sequence diagram illustrates how the complete operation is executed when date given.

<img src="images/CompleteSequenceDiagram.png" width="800"/>

> :warn: The lifeline of the diagram should end at the destroyer mark (X) but reaches end of diagram due to limitation of plantUML
The following activity diagram illustrates how the complete operation is executed.
The following activity diagram illustrates how the complete operation is executed.

<img src="images/CompleteActivityDiagram.png" width="800"/>

@@ -296,7 +294,7 @@ in the `UniquePersonsList` class as `UniquePersonsList#gatherEmails(GatherEmails

The `UniquePersonsList` class maintains a list of unique persons. Additionally, it implements the following operation:
* `UniquePersonsList#gatherEmails(GatherEmailPrompt prompt)` —  This method iterates through the persons list
and calls `GatherEmailPrompt#gatherEmails(Person person)`, passing in each person.
and calls `GatherEmailPrompt#gatherEmails(Person person)`, passing in each person.

Depending on the scenario, it triggers either `Person#gatherEmailsContainsTag(String prompt)` or
`Person#gatherEmailsContainsFinancialPlan(String prompt)`:
@@ -339,14 +337,13 @@ _{more aspects and alternatives to be added}_

### Expanded Find feature

The enhanced find mechanism is facilitated by the `CombinedPredicate` and utilises the existing `FindCommand` structure.
The enhanced find mechanism is facilitated by the `CombinedPredicate` and utilises the existing `FindCommand` structure.
It extends the `find` command with the ability to search for multiple terms at once, implemented using an array
of `PersonContainsKeywordsPredicate`. Here's a partial class diagram of the `CombinedPredicate`.
![CombinedPredicateClassDiagram](images/CombinedPredicateClassDiagram.png)

In the `FindCommandParser`, `CombinedPredicate` is initialised with a `NameContainsKeywordsPredicate`,
`FinancialPlanContainsKeywordsPredicate` and `TagContainsKeywordsPredicate`. These predicates check a `Person` if the
respective field contains any of the keywords supplied to the predicate.
`FinancialPlanContainsKeywordsPredicate` and `TagContainsKeywordsPredicate`. These predicates check a `Person` if the respective field contains any of the keywords supplied to the predicate.

Note that only `NameContainsKeywordsPredicate` checks for whole words, because it is rare to search for people by
substrings e.g. `Marc` and `Marcus` should not show up in the same search. On the other hand,
@@ -396,7 +393,7 @@ time. This feature is facilitated through the `SortCommand` class.
The `SortCommand` class is instantiated by the `SortCommandParser`, which parses user input commands. The
`SortCommandParser` class implements the following operations:

- **`SortCommandParser#parse(String args)` —  Checks the sort command keyword passed in by the user.
- **`SortCommandParser#parse(String args)` —  Checks the sort command keyword passed in by the user.

The `SortCommand` takes in a `Comparator<Person>` object and passes it into the current `Model` model. The
`SortCommand` class implements the following operations:
@@ -872,8 +869,7 @@ symbols so that names like `Thaarshen s/o Thaarshen` and `O'Brien` are accepted.
validity checker for both fields.
5. The current `gather` command does not allow the gathering of all emails in the contact book or by multiple fields
at once. To allow the gathering of all the persons emails using `gather all` command, we plan create another
`GatherEmailPrompt` class, with a method that will call the Person `getEmail()` method. To allow gathering emails
by multiple fields, for example using the `fp/` and `t/` prefixes at once, we plan to use a similar approach
`GatherEmailPrompt` class, with a method that will call the Person `getEmail()` method. To allow gathering emails by multiple fields, for example using the `fp/` and `t/` prefixes at once, we plan to use a similar approach
to `find` but return the person's email instead.
6. The `complete`, `add`, `edit` and `schedule` commands currently display the whole list (i.e. undoes the result of
any `find` command) after being executed, which might cause users to become disoriented. We plan to disable this
@@ -951,8 +947,19 @@ testers are expected to do more *exploratory* testing.

### Saving data

1. Dealing with missing/corrupted data files

1. _{explain how to simulate a missing/corrupted file, and the expected behavior}_
1. Dealing with missing data files
1. If there is no saved data, the application will open with a new data file loaded with sample data
2. To do this:
1. Go to the location of the saved data. The location of the saved data can be found at the bottom left of the UNOFAS app.
2. Delete the file `addressbook.json`.
3. Restart the application.
3. A new file with sample contacts and appointments will be created.

2. Dealing with corrupted data files
1. If saved data is corrupted, the application will wipe the corrupted data and restart with no contacts and appointments.
2. To simulate a corrupted file:
1. Go to the location of the saved data.
2. Open `addressbook.json` and corrupt the file in a way that makes it an invalid file to read (e.g. adding alphabets into a contact's phone number field)
3. Restart the application.
3. A new file will be created with no contacts and appointments.

2. _{ more test cases …​ }_
71 changes: 45 additions & 26 deletions docs/UserGuide.md
Original file line number Diff line number Diff line change
@@ -15,6 +15,10 @@ Click on the relevant links to easily navigate through the guide and access the

## Table of Contents
* [Quick Start](#quick-start)
* [UI Components](#ui-components)
* [General UI Information](#general-ui-information)
* [Contact Card](#contact-card)
* [Appointment Card](#appointment-card)
* [Features](#features)
* [Help](#viewing-help--help)
* [Add](#adding-a-person--add)
@@ -33,7 +37,7 @@ Click on the relevant links to easily navigate through the guide and access the

--------------------------------------------------------------------------------------------------------------------

## Quick start
## Quick Start

1. Ensure you have Java `11` or above installed in your Computer.

@@ -63,6 +67,36 @@ Click on the relevant links to easily navigate through the guide and access the

1. Refer to the [Features](#features) below for details of each command.

--------------------------------------------------------------------------------------------------------------------
## UI Components

![generalUi](images/generalUi.png)

### General UI information

Component | Purpose
--------|------------------
**Navigation Bar** | Allows you to exit UNOFAS or view help
**Command Line** | Location to enter commands
**Result Line** | Displays the result after a command is entered
**Contact List** | Displays clients
**Appointment List** | Displays appointments
**Contact Card** | Displays detailed information about a patient
**Appointment Card** | Displays detailed information about an appointment
**Save Location** | Displays the location where your UNOFAS data is stored

### Contact Card

![contactCardUi](images/contactCardUi.png)

* Shows the client's name, phone number, financial plan(s) (if any), address, email address, next-of-kin name, next-of-kin phone number, appointment (if any) and tag(s) (if any).

### Appointment Card

![appointmentCardUi](images/appointmentCardUi.png)

* Shows the appointment name, client allocated to the appointment and the appointment date and time.

--------------------------------------------------------------------------------------------------------------------

# Features
@@ -121,7 +155,6 @@ to view the arguments' prefix, and their acceptable values.

-----------------------
### Viewing help : `help`
> :warning: Due to new features, help page is currently being updated.

Shows a message explaining how to access the help page, as well as a list of available keywords.

@@ -135,7 +168,7 @@ Format: `help`
Add a client’s contacts to contact book (name, phone number, email, home address, next-of-kin name, next-of-kin phone
number) into contact book.

Format: `add n/NAME p/PHONE_NUMBER e/EMAIL a/ADDRESS nk/NEXT_KIN nkp/NEXT_KIN_PHONE [fp/FINANCIAL_PLAN] [t/TAG]…​`
Format: `add n/NAME p/PHONE_NUMBER e/EMAIL a/ADDRESS nk/NEXT_KIN nkp/NEXT_KIN_PHONE [fp/FINANCIAL_PLAN] [t/TAG]…​`

* Adding a person with the exact same name (case-sensitive) as a person currently in the contact book counts as a
duplicate and will cause the command to fail. Duplicate information in other ways does not count as a duplicate
@@ -150,23 +183,6 @@ A person can have any number of Financial Plans (including 0).
A person can have any number of tags (including 0).
</div>

Examples:
* `add n/John p/80101010 e/johndoe@gmail.com a/Punggol Central Blk 444 #15-32 820123 nk/Brennan nkp/82020202`

Successful Output: `New person added: John;
Phone: 80101010;
Email: johndoe@gmail.com;
Address: Punggol Central Blk 444 #15-32 820123;
Next-of-kin Name: Brennan;
Next-of-kin Phone: 82020202;
Appointment: No Appointment made!;
Financial Plans: ;
Tags:`

![result for 'add n/John p/80101010 e/johndoe@gmail.com a/Punggol Central Blk 444 #15-32 820123 nk/Brennan nkp/82020202'](images/addUi.png)

You can also add a client's contacts with a tag and a financial plan.

Examples:
* `add n/John p/80101010 e/johndoe@gmail.com a/Punggol Central Blk 444 #15-32 820123 nk/Brennan nkp/82020202 t/80yo fp/Financial Plan C`

@@ -180,14 +196,16 @@ Appointment: No Appointment made!;
Financial Plans: [Financial Plan C];
Tags: [80yo]`

![result for 'add n/John p/80101010 e/johndoe@gmail.com a/Punggol Central Blk 444 #15-32 820123 nk/Brennan nkp/82020202 t/80yo fp/Financial Plan C'](images/addUi.png)

<div markdown="span" class="alert alert-primary">:information_source:
**Do note** that it is possible to add a client's contact with multiple tags by duplicating the `t/` prefix. The same can be done with for financial plans with the `fp/` prefix.
**Do note** that it is possible to add a client's contact with multiple tags by duplicating the `t/` prefix. The same can be done for financial plans with the `fp/` prefix.
</div>

------------------
### Listing all persons : `list`

Display a list of all the clients and their contact details
Display a list of all the clients and their contact details.

Format: `list`

@@ -212,8 +230,8 @@ not count as a duplicate person.
of tags is not cumulative.
* You can remove all the person’s tags by typing `t/` without specifying any tags after it.
* You can remove all the person’s financial plans by typing `fp/` without
specifying any tags after it.
* A person's appointment cannot in edited in this manner. Refer to [Schedule](#scheduling-an-appointment--schedule).
specifying any financial plans after it.
* A person's appointment cannot be edited in this manner. Refer to [Schedule](#scheduling-an-appointment--schedule).

Acceptable Values: Refer to [Argument Summary](#argument-summary).

@@ -257,8 +275,8 @@ Format: `find [n/NAME]…​ [fp/FINANCIAL_PLAN]…​ [t/TAG]…​`
Acceptable Values: Refer to [Argument Summary](#argument-summary).

Examples:
* `find n/John` returns `john` and `John Doe`
* `find n/john n/charlie` returns `Charlie`, `john doe`<br>

![result for 'find john charlie'](images/findJohnCharlieResult.png)

### Gathering emails of matching persons : `gather`
@@ -414,7 +432,7 @@ UNOFAS data are saved in the hard disk automatically after any command that chan
UNOFAS data are saved automatically as a JSON file `[JAR file location]/data/addressbook.json`. Advanced users are welcome to update data directly by editing that data file.

<div markdown="span" class="alert alert-warning"> :exclamation: **Caution:**
If your changes to the data file makes its format invalid, UNOFAS will discard all data when a command is executed with the corrupted file and start with an empty data file at the next run. Hence, it is recommended to take a backup of the file before editing it.
If your changes to the data file makes its format invalid, UNOFAS will discard all data and start with an empty data file at the next run. Hence, it is recommended to take a backup of the file before editing it.
</div>

### Archiving data files `[coming in v2.0]`
@@ -436,6 +454,7 @@ _Details coming soon ..._
2. **Long names** for Financial Plans and Tags may not be fully visible.
3. **When sorting the list**, we have chosen to not implement returning sorted list to original ordering due to the lack of necessity. However, due to feedback, we will implement this in the next release to enable users to return list to original order should they wish to.
4. It is possible to add appointments with dates before the current date and time.

--------------------------------------------------------------------------------------------------------------------

## Command summary
27 changes: 12 additions & 15 deletions docs/diagrams/UiClassDiagram.puml
Original file line number Diff line number Diff line change
@@ -10,7 +10,6 @@ Class "{abstract}\nUiPart" as UiPart
Class UiManager
Class MainWindow
Class HelpWindow
Class ClearWindow
Class OverrideWindow
Class ResultDisplay
Class PersonListPanel
@@ -33,33 +32,31 @@ Class HiddenOutside #FFFFFF
HiddenOutside ..> Ui

UiManager .left.|> Ui
UiManager -down--> "1" MainWindow
UiManager -down-> "1" MainWindow
MainWindow *-down--> "1" CommandBox
MainWindow *-down--> "1" ResultDisplay
MainWindow *-down--> "1" PersonListPanel
MainWindow *-down--> "1" AppointmentListPanel
MainWindow *-down---> "1" StatusBarFooter
MainWindow -> "0..1" HelpWindow
MainWindow -> "0..1" ClearWindow
MainWindow -> "0..1" OverrideWindow
MainWindow *-down--> "1" StatusBarFooter
MainWindow --> "0..1" HelpWindow
MainWindow --> "0..1" OverrideWindow

PersonListPanel -down-> "*" PersonCard
AppointmentListPanel -down-> "*" AppointmentCard

MainWindow -left-|> UiPart

ResultDisplay ---|> UiPart
CommandBox ---|> UiPart
PersonListPanel ---|> UiPart
PersonCard ----|> UiPart
ResultDisplay --|> UiPart
CommandBox --|> UiPart
PersonListPanel --|> UiPart
PersonCard --|> UiPart
AppointmentListPanel --|> UiPart
AppointmentCard --|> UiPart
StatusBarFooter -----|> UiPart
HelpWindow ---|> UiPart
ClearWindow ---|> UiPart
OverrideWindow -|> UiPart
StatusBarFooter --|> UiPart
HelpWindow --|> UiPart
OverrideWindow --|> UiPart

PersonCard ....> Model
PersonCard ...> Model
AppointmentCard ...> Model
UiManager -right-> Logic
MainWindow -left-> Logic
Binary file modified docs/images/Ui.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 modified docs/images/UiClassDiagram.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 modified docs/images/addUi.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/appointmentCardUi.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 modified docs/images/completeUi.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/contactCardUi.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 modified docs/images/editUi.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 modified docs/images/gatherUi.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/generalUi.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 modified docs/images/scheduleUi.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 modified docs/images/sortUi.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 15 additions & 7 deletions docs/team/nikele2001.md
Original file line number Diff line number Diff line change
@@ -13,20 +13,28 @@ such as sorting, scheduling and other commands to query information quickly requ

Given below are my contributions to the project.

* **New Feature**: Added `FinancialPlan` field and wrote tests
* Justification: As a financial advisor, it would be convenient to have a person's current financial plans available for business purposes.
* (Pull request [#69](https://github.com/AY2324S1-CS2103T-F12-1/tp/pull/69))

* **New Feature**: Added appointment sidebar that shows upcoming appointments of clients in chronological order and wrote tests
* Justification: Financial advisors may want to view all upcoming appointments easily in chronological order so that it is easier for them to plan their timetables.
* Highlights: This enhancement creates another UI element to show various other appointment-specific details in the future. It requires an understanding of ObservableList interface and the way the list is being tracked by JavaFX.
* (Pull request [#110](https://github.com/AY2324S1-CS2103T-F12-1/tp/pull/110))

* **Code Contributed**: [RepoSense](https://nus-cs2103-ay2324s1.github.io/tp-dashboard/?search=nikele2001&breakdown=true)

* **Enhancements Implemented**:
* Added `FinancialPlan` field and wrote tests
(Pull request [#69](https://github.com/AY2324S1-CS2103T-F12-1/tp/pull/69))
* Added appointment sidebar that shows upcoming appointments of clients in chronological order and wrote tests (Pull request [#110](https://github.com/AY2324S1-CS2103T-F12-1/tp/pull/110))
* **Enhancements Implemented**:
* `FinancialPlan` field to allow financial advisors to execute commands specific to financial plans subscribed by clients
* Override prompt to ask user for confirmation before overriding an appointment.

* **Contributions to the UG**:
* **Contributions to the UG**:
* Added and updated all UI images.

* **Contributions to the DG**:
* **Contributions to the DG**:
* Added use cases for `schedule` command, adding financial plans via the `fp/` prefix and sorting clients' contacts.

* **Contributions to team-based tasks**:
* **Contributions to team-based tasks**:
* Set up team organisation.
* Set up TP repository.
* Set up Jekyll.
1 change: 1 addition & 0 deletions docs/team/sopa301.md
Original file line number Diff line number Diff line change
@@ -24,6 +24,7 @@ Given below are my contributions to the project.
* Justification: `clear` is a very powerful command that can delete the entirety of a user's work in an instant. To
safeguard against mistakes, we decided to add an extra confirmation requirement to ensure that the user actually wants
to wipe the contact book.
* Highlights: This feature causes the logic flow of the method to change if the clear command is about to be executed, getting a response from the user before deciding whether to continue the execution of the program.
* Pull request [#75](https://github.com/AY2324S1-CS2103T-F12-1/tp/pull/75)
* Added available keywords for `help` command
* Pull request [#67](https://github.com/AY2324S1-CS2103T-F12-1/tp/pull/67)
12 changes: 12 additions & 0 deletions src/main/java/seedu/address/MainApp.java
Original file line number Diff line number Diff line change
@@ -88,11 +88,23 @@ private Model initModelManager(Storage storage, ReadOnlyUserPrefs userPrefs) {
logger.warning("Data file at " + storage.getAddressBookFilePath() + " could not be loaded."
+ " Will be starting with an empty AddressBook.");
initialData = new AddressBook();
this.saveEmptyAddressBook(initialData);
}

return new ModelManager(initialData, userPrefs);
}

/**
* Wipes corrupted data in addressbook.json when starting the application with corrupted data.
*/
private void saveEmptyAddressBook(ReadOnlyAddressBook initialData) {
try {
storage.saveAddressBook(initialData);
} catch (IOException e) {
logger.warning("Failed to locate filepath.");
}
}

private void initLogging(Config config) {
LogsCenter.init(config);
}

0 comments on commit 4c6aac4

Please sign in to comment.