From 1af555b04debb4b787fbf793f15bd478bc98fbde Mon Sep 17 00:00:00 2001 From: jianyangg Date: Sat, 11 Nov 2023 18:16:38 +0800 Subject: [PATCH 01/17] Updated DG - Use Case and User Stories Slight edits to each. --- docs/DeveloperGuide.md | 65 ++++++++++++++++++++++++------------------ 1 file changed, 37 insertions(+), 28 deletions(-) diff --git a/docs/DeveloperGuide.md b/docs/DeveloperGuide.md index d3642f8435e..e37424bcf6f 100644 --- a/docs/DeveloperGuide.md +++ b/docs/DeveloperGuide.md @@ -859,20 +859,20 @@ thereby improving efficiency for business owners. Priorities: High (must have) - `***`, Medium (nice to have) - `**`, Low (unlikely to have) - `*` -| Priority | As a …​ | I want to …​ | So that I can…​ | +| Priority | As …​ | I want to …​ | So that …​ | |----------|--------------------|--------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| `***` | an owner | create a local account | I can personalise and secure my account. | +| `***` | an owner | create a local account | I can personalise my account and secure my data. | | `***` | a registered owner | log in to my local account | I can access my data. | -| `***` | a forgetful owner | retrieve my account | I can still recover my data. | +| `***` | a forgetful owner | retrieve my account | I can still recover my data if I forget my password. | | `***` | a logged-in owner | log out of my account | I can keep my data secure. | -| `***` | a registered owner | delete my account | I can have greater control over my data and account removal for privacy reasons. | +| `***` | a registered owner | delete my account | I can clear all personal information or data from HomeBoss for privacy and security reasons. | | `***` | a registered owner | update my details | I can change my personalisation. | | `***` | a registered owner | create a customer | I can tie deliveries to customers’ information. | | `***` | a registered owner | view a customer | I can see their detailed information. | | `***` | a registered owner | see a customer's list of deliveries | I can easily see all the deliveries of a certain customer. | | `***` | a registered owner | quickly search for the details of a client | I can monitor the progress of an order efficiently and effectively. | | `***` | a registered owner | update a customer | I can change details if keyed in wrongly. | -| `***` | a registered owner | delete a customer | I can remove redundant or incorrect customer records, especially when unforeseen errors occur. | +| `***` | a registered owner | delete a customer | I can remove redundant customer records, especially when a customer is no longer relevant to my business. | | `***` | a registered owner | view a list of customers | I can have a comprehensive overview of my customer base. | | `***` | a registered owner | create a delivery | I can efficiently organise and access delivery information. | | `***` | a registered owner | create notes about deliveries | I can add additional information about deliveries. | @@ -948,8 +948,8 @@ Priorities: High (must have) - `***`, Medium (nice to have) - `**`, Low (unlikel ### Use cases -(For all use cases below, the **System** is the `HomeBoss` and the **Actor** is the `user`, unless specified -otherwise) +For all use cases below, the **System** is `HomeBoss` and the **Actor** is the `user`, unless specified +otherwise. #### Use Case: UC01 - Register an Account @@ -968,21 +968,22 @@ otherwise) 1. Unregistered owner opens HomeBoss application. 2. Unregistered owner enters register command with his username, password, confirm password, a "forget password" - question and answer. -3. US creates an account and shows a welcome message with the newly created username. + secret question and answer. +3. US creates an account and shows a welcome message. The GUI footer is updated with the username. + Use case ends. **Extensions:** * 2a. Unregistered owner does not enter one of the fields. - * 2a1. US requests unregistered owner to fill up all the required fields. + * 2a1. US requests unregistered owner to fill up all the required fields by showing expected command format. Use case ends. * 2b. Unregistered owner types incorrect confirm password. - * 2b1. US requests unregistered owner to retype their confirm password. + * 2b1. US points out password mismatch and requests unregistered owner to try again. Use case ends. @@ -1027,31 +1028,33 @@ otherwise) **Actor:** Registered owner -**Preconditions:** Registered owner is logged out. +**Preconditions:** An owner is registered with HomeBoss. **Guarantees:** -- Password would be changed. +- Password will be changed. **MSS:** 1. Registered owner opens the HomeBoss application. -2. Registered owner enters the account recovery command without any command flags (i.e., `--answer`). -3. US displays the forget password question that the user set during account registration. +2. Registered owner enters the account recovery command without any command flags (i.e., no `--answer`). +3. US displays the "forget password" secret question that the user set during account registration, together with the + command format for account recovery. 4. Registered owner enters the account recovery command, this time with the answer, new password and confirm password fields. -5. US logins and shows a success message. +5. US logs in and shows a success message confirming account recovery. + Use case ends. **Extensions:** * 4a. Registered owner does not enter the answer field. - * 4a1. US requests registered owner to fill up the answer field. + * 4a1. US requests registered owner to fill up all the required fields, and shows the expected command format. Use case ends. -* 4b. Registered owner types incorrect answer - * 4b1. US requests registered owner to retype their answer. +* 4b. Registered owner types incorrect answer. + * 4b1. US says that the answer is incorrect and requests registered owner to try again. Use case ends. @@ -1060,8 +1063,8 @@ otherwise) Use case ends. -* 4d. Registered owner types incorrect confirm password. - * 4d1. US requests registered owner to retype their confirm password. +* 4d. Registered owner types a password and confirm password that do not match. + * 4d1. US says that the passwords do not match and requests registered owner to try again. Use case ends. @@ -1091,7 +1094,7 @@ otherwise) **System:** User System (US) -**Actor:** Logged-in owner. +**Actor:** Registered owner. **Preconditions:** Account is present. @@ -1101,7 +1104,7 @@ otherwise) **MSS:** -1. Logged-in owner types command to delete his account. +1. Registered owner types command to delete his account. 2. User system shows a success message. Use case ends. @@ -1343,7 +1346,7 @@ otherwise) **Guarantees:** -- Selected customer is deleted only if the command is executed successfully. +- Selected customer is deleted if the command is executed successfully. **MSS:** @@ -1354,15 +1357,21 @@ otherwise) **Extensions:** -- 1a. Logged-in Owner specifies invalid customer. +- 1a. Logged-in Owner specifies a customer ID that does not exist is a positive integer. - - 1a1. CMS displays an error to Logged-in Owner that the specified customer does not exist. + - 1a1. CMS displays an error to Logged-in Owner that the specified customer ID is invalid. Use Case Ends. -- 1b. Logged-in Owner does not specify customer. +- 1b. Logged-in Owner specifies a non-positive integer as customer ID. + + - 1b1. CMS displays an error to Logged-in Owner that the command format used is invalid, and shows the expected + command format. + +- 1c. Logged-in Owner does not specify customer ID. - - 1b1. CMS displays an error to Logged-in Owner to specify a customer to update. + - 1c1. CMS displays an error to Logged-in Owner that the command format used is invalid, and shows the expected + command format. Use Case Ends. From 3776c99e66a16c2ce51024f132e52bf3f91922d2 Mon Sep 17 00:00:00 2001 From: zhonghan721 Date: Sat, 11 Nov 2023 23:06:41 +0800 Subject: [PATCH 02/17] Update DG implementations details --- docs/DeveloperGuide.md | 49 ++++++++++--------- docs/diagrams/CustomerAddSequenceDiagram.puml | 4 +- docs/diagrams/UserLoginActivityDiagram.puml | 6 +-- docs/diagrams/UserLoginSequenceDiagram.puml | 10 +++- docs/diagrams/UserLogoutSequenceDiagram.puml | 4 +- 5 files changed, 41 insertions(+), 32 deletions(-) diff --git a/docs/DeveloperGuide.md b/docs/DeveloperGuide.md index d3642f8435e..730101dbb51 100644 --- a/docs/DeveloperGuide.md +++ b/docs/DeveloperGuide.md @@ -509,10 +509,11 @@ The format for the `login` command can be found [here](UserGuide.md#login). 1. The user specifies the `Username` and `Password` in the `login` command. 2. If any of the fields is not provided, an error message with the correct command usage will be shown. 3. If invalid command parameters are provided, an error message with the correct parameter format will be shown. -4. If the user is currently logged in, an error message will be shown. -5. The `User` is then cross-referenced with the stored user in `Model` to check if the credentials match. +4. If there is no registered account found, an error message will be shown. +5. If the user is currently logged in, an error message will be shown. +6. The `User` is then cross-referenced with the stored user in `Model` to check if the credentials match. If incorrect credentials are provided, an error message regarding wrong credentials will be shown. -6. If all the previous steps are completed without exceptions, the user will be logged in and the +7. If all the previous steps are completed without exceptions, the user will be logged in and the `isLoggedIn` status in `Model` will be updated to `true`. The following activity diagram shows the logic of a user logging in: @@ -526,11 +527,12 @@ The sequence of the `login` command is as follows: 2. The user inputs the `login` command with the username and password. 3. The `userLoginCommandParser` checks whether all the required fields are present. If all fields are present, it creates a new `userLoginCommand`. -4. The `userLoginCommand` checks whether the user is currently logged in by calling `Model#getUserLoginStatus()`. -5. The `userLoginCommand` then checks if the user credentials match the stored user by calling `Model#userMatches()`. -6. If the user is not logged in and the credentials match, the `userLoginCommand` calls `Model#setLoginSuccess()`, - changing the login status to true and enabling the user access to all commands. -7. The `userLoginCommand` also calls `Model#updateFilteredPersonList()` to display the list of customers. +4. The `userLoginCommand` checks whether there is a registered account stored by calling `Model#getStoredUser`. +5. The `userLoginCommand` then checks whether the user is currently logged in by calling `Model#getUserLoginStatus`. +6. The `userLoginCommand` then checks if the user credentials match the stored user by calling `Model#userMatches`. +7. If the user is not logged in and the credentials match, the `userLoginCommand` calls `Model#setLoginSuccess`, + changing the login status to true and giving the user access to all commands. +8. The `userLoginCommand` also calls `Model#showAllFilteredCustomerList` to display the list of customers. The following sequence diagram shows how the `login` command works: @@ -562,16 +564,17 @@ The sequence of the `logout` command is as follows: 1. The user inputs the `logout` command. 2. A new `userLogoutCommand` is created and checks whether the user is currently logged out - by calling `Model#getUserLoginStatus()`. -3. If the user is currently logged in, the `userLogoutCommand` calls `Model#setLogoutSuccess()`, + by calling `Model#getUserLoginStatus`. +3. If the user is currently logged in, the `userLogoutCommand` calls `Model#setLogoutSuccess`, changing the login status to false and restricting the user access to most commands. -4. The `userLoginCommand` also calls `Model#updateFilteredPersonList()` to hide the list of customers. +4. The `userLoginCommand` also calls `Model#clearFilteredDeliveryList` and `Model#clearFilteredCustomerList` + to hide the list of deliveries and customers. -The following sequence diagram shows how the `login` command works: +The following sequence diagram shows how the `logout` command works: -### Add Customer Command +### Customer Add Command **Overview:** @@ -586,8 +589,8 @@ The format for the `customer add` command can be found [here](UserGuide.md#add-a 2. If any of the fields is not provided, an error message with the correct command usage will be shown. 3. If invalid command parameters are provided, an error message with the correct parameter format will be shown. 4. If the user is currently not logged in, an error message will be shown. -5. The `Customer` is then cross-referenced in the `Model` to check if a customer with the same `Name` already exists. - If a customer with the same `Name` exists, an error message will be shown. +5. The `Customer` is then cross-referenced in the `Model` to check if a customer with the same `Phone` already exists. + If a customer with the same `Phone` exists, an error message will be shown. 6. If all the previous steps are completed without exceptions, the new `Customer` will be successfully added to the database. @@ -597,19 +600,19 @@ The following activity diagram shows the logic of adding a `Customer` into the d The sequence of the `customer add` command is as follows: -1. The user inputs the `customer add ARG` command (e.g. `customer add --name Gabriel --phone 87654321 +1. The user inputs the `customer add` command (e.g. `customer add --name Gabriel --phone 87654321 --email gabrielrocks@gmail.com --address RVRC Block B`). -2. The `LogicManager` calls the `AddressBookParser#parseCommand` with `ARG` to parse the command. +2. The `LogicManager` calls the `AddressBookParser#parseCommand` with the user input to parse the command. 3. The `AddressBookParser` then creates a new `CustomerAddCommandParser` to parse the fields provided by the user. 4. A corresponding `Customer` is created by the `CustomerAddCommandParser`, which is used to create a new `CustomerAddCommand`. -5. The `CustomerAddCommand` checks whether the user is currently logged in by calling `Model#getUserLoginStatus()`. -6. The `CustomerAddCommand` then checks if the `Model` contains a customer with the same `Name` - by calling `Model#hasPerson`. -7. If the user is logged in and the `Model` does not contain a customer with the same `Name`, the `CustomerAddCommand` - calls `Model#addPerson` to add the new `Customer` to the database. +5. The `CustomerAddCommand` checks whether the user is currently logged in by calling `Model#getUserLoginStatus`. +6. The `CustomerAddCommand` then checks if the `Model` contains a customer with the same `Phone` + by calling `Model#hasCustomer`. +7. If the user is logged in and the `Model` does not contain a customer with the same `Phone`, the `CustomerAddCommand` + calls `Model#addCustomer` to add the new `Customer` to the database. -The following sequence diagram shows how the `login` command works: +The following sequence diagram shows how the `customer add` command works: diff --git a/docs/diagrams/CustomerAddSequenceDiagram.puml b/docs/diagrams/CustomerAddSequenceDiagram.puml index 73b6c903597..023bb0d3bcf 100644 --- a/docs/diagrams/CustomerAddSequenceDiagram.puml +++ b/docs/diagrams/CustomerAddSequenceDiagram.puml @@ -62,13 +62,13 @@ activate Model Model --> CustomerAddCommand : isLoggedIn deactivate Model -CustomerAddCommand -> Model : hasPerson(c) +CustomerAddCommand -> Model : hasCustomer(c) activate Model Model --> CustomerAddCommand deactivate Model -CustomerAddCommand -> Model : addPerson(c) +CustomerAddCommand -> Model : addCustomer(c) activate Model Model --> CustomerAddCommand diff --git a/docs/diagrams/UserLoginActivityDiagram.puml b/docs/diagrams/UserLoginActivityDiagram.puml index 9f7d0513d8b..50f776902ab 100644 --- a/docs/diagrams/UserLoginActivityDiagram.puml +++ b/docs/diagrams/UserLoginActivityDiagram.puml @@ -10,13 +10,13 @@ start if () then ([else]) :ParseException: Invalid Command Format; stop -([all fields are filled]) elseif () then ([user is already logged in]) +( [all fields are filled]) elseif () then ([user is already logged in]) :CommandException: Already Logged In; stop -([else]) elseif () then ([else]) +( [else]) elseif () then ([else]) :CommandException: Wrong Credentials; stop -else ([fields matches +else ( [fields matches stored user]) endif diff --git a/docs/diagrams/UserLoginSequenceDiagram.puml b/docs/diagrams/UserLoginSequenceDiagram.puml index 5664adde9e5..599f4f8af56 100644 --- a/docs/diagrams/UserLoginSequenceDiagram.puml +++ b/docs/diagrams/UserLoginSequenceDiagram.puml @@ -31,7 +31,7 @@ AddressBookParser -> UserLoginCommandParser : parse(arg) activate UserLoginCommandParser create User -UserLoginCommandParser -> User : new User(username, password) +UserLoginCommandParser -> User : new User(username, password, true) activate User User --> UserLoginCommandParser @@ -56,6 +56,12 @@ deactivate AddressBookParser LogicManager -> UserLoginCommand : execute(model) activate UserLoginCommand +UserLoginCommand -> Model : getStoredUser() +activate Model + +Model --> UserLoginCommand : storedUser +deactivate Model + UserLoginCommand -> Model : getUserLoginStatus() activate Model @@ -74,7 +80,7 @@ activate Model Model --> UserLoginCommand deactivate Model -UserLoginCommand -> Model : updateFilteredPersonList(PREDICATE_SHOW_ALL_CUSTOMERS) +UserLoginCommand -> Model : showAllFilteredCustomerList() activate Model Model --> UserLoginCommand diff --git a/docs/diagrams/UserLogoutSequenceDiagram.puml b/docs/diagrams/UserLogoutSequenceDiagram.puml index 933c0186597..c1121ec0ae2 100644 --- a/docs/diagrams/UserLogoutSequenceDiagram.puml +++ b/docs/diagrams/UserLogoutSequenceDiagram.puml @@ -43,13 +43,13 @@ activate Model Model --> UserLogoutCommand deactivate Model -UserLogoutCommand -> Model : updateFilteredPersonList(PREDICATE_SHOW_NO_CUSTOMERS) +UserLogoutCommand -> Model : clearFilteredDeliveryList() activate Model Model --> UserLogoutCommand deactivate Model -UserLogoutCommand -> Model : updateFilteredDeliveryList(PREDICATE_SHOW_NO_DELIVERIES) +UserLogoutCommand -> Model : clearFilteredCustomerList() activate Model Model --> UserLogoutCommand From 48fc038b7cd7b0451b64b80ec083a588f24ffe8c Mon Sep 17 00:00:00 2001 From: Julius Bryan <67666355+juliusgambe@users.noreply.github.com> Date: Sun, 12 Nov 2023 00:48:13 +0800 Subject: [PATCH 03/17] Fix DeliveryList and DeliveryView Use Case --- docs/DeveloperGuide.md | 105 +++++++++++++++++++++++++++-------------- 1 file changed, 69 insertions(+), 36 deletions(-) diff --git a/docs/DeveloperGuide.md b/docs/DeveloperGuide.md index 03254bc770b..9a91a8cba6d 100644 --- a/docs/DeveloperGuide.md +++ b/docs/DeveloperGuide.md @@ -1479,80 +1479,113 @@ otherwise) **MSS:** 1. Logged-in Owner types command to view a list of deliveries. -2. DMS displays a list of all deliveries sorted in descending expected delivery date (newest to oldest). +2. DMS displays a list of all deliveries sorted in descending expected delivery date (latest to earliest). Use Case Ends. **Extensions:** -* 1a. User specifies status field in command. - * 1a1. DMS display a list of deliveries filtered by the specified status. +- 1a. User specifies status field in command. + + - 1a1. DMS display a list of deliveries filtered with the specified status. Use Case Ends. -* 1b. User specifies customer field in command. - * 1b1. DMS displays a list of deliveries filtered by the specified customer. +- 1b. User specifies customer field in command. + + - 1b1. DMS displays a list of deliveries filtered by the specified customer id. Use Case Ends. -* 1c. User specifies expected delivery date field in command. - * 1c1. DMS displays a list of deliveries filtered by the specified expected delivery date. +- 1c. User specifies expected delivery date field in command. + + - 1c1. DMS displays a list of deliveries filtered by the specified expected delivery date. Use Case Ends. -* 1d. User specifies both status and customer fields. - * 1c1. DMS displays a list of deliveries filtered by the specified status and customer. +- 1d. User specifies expected delivery date field as "TODAY" in command. + + - 1d1. DMS displays a list of deliveries filtered by the expected delivery date that is today's date. Use Case Ends. -* 1e. User specifies both status and expected delivery date fields. - * 1e1. DMS displays a list of deliveries filtered by the specified status and expected delivery date. +- 1e. User specifies both status and customer fields. + + - 1e1. DMS displays a list of deliveries filtered by the specified status and customer. Use Case Ends. -* 1f. User specifies both customer and expected delivery date fields. - * 1f1. DMS displays a list of deliveries filtered by the specified customer and expected delivery date. +- 1f. User specifies both status and expected delivery date fields. + + - 1f1. DMS displays a list of deliveries filtered by the specified status and expected delivery date. Use Case Ends. -* 1g. User specifies customer, expected delivery date and status fields. - * 1g1. DMS displays a list of deliveries filtered by the specified customer, expected delivery date and status. + +- 1g. User specifies both status and expected delivery date fields as "TODAY". + + - 1g1. DMS displays a list of deliveries filtered by the specified status and expected delivery date that is today's + date. Use Case Ends. -* 1g. User specifies sort field in command. - * 1b1. DMS displays a list of all deliveries sorted by the specified sort order. + +- 1h. User specifies both customer and expected delivery date fields. + + - 1h1. DMS displays a list of deliveries filtered by the specified customer and expected delivery date. Use Case Ends. -* 1h. User Specifies both filter fields and sort fields. - * 1c1. DMS displays a list of deliveries filtered by the specified filters and then expected delivery date sorted - by the specified sort order. +- 1i. User specifies both customer and expected delivery date fields as "TODAY". + + - 1i1. DMS displays a list of deliveries filtered by the specified customer and expected delivery date that is + today's date. Use Case Ends. -#### **Use case:** UC16 - Delivery List for the Day +- 1j. User specifies customer, expected delivery date and status fields. -**System:** Delivery Management System (DMS) -**Actor:** Logged-in owner. + - 1j1. DMS displays a list of deliveries filtered by the specified customer, expected delivery date and status. -**Preconditions:** Owner is logged in. + Use Case Ends. -**Guarantees:** +- 1k. User specifies customer, expected delivery date as "TODAY" and status fields. -- A list of deliveries for the day is displayed only if the command is executed successfully. + - 1k1. DMS displays a list of deliveries filtered by the specified customer, expected delivery date that is today's + date and status. -**MSS:** + Use Case Ends. -1. Logged-in Owner types command to view a list of deliveries for the day. -2. DMS displays a list of deliveries for the day. +- 1l. User specifies sort field in command. - Use Case Ends. + - 1l1. DMS displays a list of all deliveries sorted by the specified sort order. -**Extensions:** + Use Case Ends. -- 1a. Command has missing fields. +- 1m. User Specifies any of the filter fields and sort field. + + - 1m1. DMS displays a list of deliveries filtered by the specified filters and then expected delivery date sorted + by the specified sort order. - - 1a1. DMS displays an error to Logged-in Owner. + Use Case Ends. + +- 1n. Logged-in Owner specifies invalid status. + + - 1n1. DMS displays an error to Logged-in Owner that the specified status is invalid and state the possible accepted + status values. + + Use Case Ends. + +- 1o. Logged-in Owner specifies an invalid date. + + - 1o1. DMS displays an error to Logged-in Owner that the specified date is in an invalid format and states what + format it should be in. + + Use Case Ends. + +- 1p. Logged-in Owner specifies an invalid sort. + + - 1p1. DMS displays an error to Logged-in Owner that the specified sort is invalid and state the possible accepted + values. Use Case Ends. @@ -1727,7 +1760,7 @@ otherwise) **System:** Delivery Management System (DMS) -**Actor:** Logged-in owner. +**Actor:** Logged-in Owner. **Preconditions:** Owner is logged-in. @@ -1746,13 +1779,13 @@ otherwise) - 1a. Logged-in owner did not specify the delivery id. - - 1a1. DMS informs the logged-in owner of the missing field. + - 1a1. DMS displays an error to Logged-in Owner to specify all required fields. Use case ends. - 1b. Logged-in owner specified a delivery id that does not exist. - - 1b1. DMS informs the logged-in owner of invalid delivery id being entered. + - 1b1. DMS displays an error to Logged-in Owner of invalid delivery id being entered. Use case ends. From 19ad867a621310ad31973a7ad9dcc242c7ec07b4 Mon Sep 17 00:00:00 2001 From: zhonghan721 Date: Sun, 12 Nov 2023 11:58:40 +0800 Subject: [PATCH 04/17] Remove refresh UI list from AD --- docs/diagrams/UserLoginActivityDiagram.puml | 1 - docs/diagrams/UserLogoutActivityDiagram.puml | 1 - 2 files changed, 2 deletions(-) diff --git a/docs/diagrams/UserLoginActivityDiagram.puml b/docs/diagrams/UserLoginActivityDiagram.puml index 50f776902ab..55709dcd160 100644 --- a/docs/diagrams/UserLoginActivityDiagram.puml +++ b/docs/diagrams/UserLoginActivityDiagram.puml @@ -22,7 +22,6 @@ else ( [fields matches endif :User login command is executed successfully. User is now logged in.; -:Show full Customer List; stop @enduml diff --git a/docs/diagrams/UserLogoutActivityDiagram.puml b/docs/diagrams/UserLogoutActivityDiagram.puml index f6bc3f06b7b..e53d4926883 100644 --- a/docs/diagrams/UserLogoutActivityDiagram.puml +++ b/docs/diagrams/UserLogoutActivityDiagram.puml @@ -13,7 +13,6 @@ if () then ([user is already logged out]) else ([else]) :User logout command is executed successfully. User is now logged out.; - :Hide Customer and Delivery List; endif stop From e822e6d2b1c4520a23ce50dcbe6a49d3fa6958bf Mon Sep 17 00:00:00 2001 From: zhonghan721 Date: Sun, 12 Nov 2023 12:13:17 +0800 Subject: [PATCH 05/17] Modify use cases --- docs/DeveloperGuide.md | 43 ++++++++++++++++++------------------------ 1 file changed, 18 insertions(+), 25 deletions(-) diff --git a/docs/DeveloperGuide.md b/docs/DeveloperGuide.md index 03254bc770b..ca51dfefa73 100644 --- a/docs/DeveloperGuide.md +++ b/docs/DeveloperGuide.md @@ -1016,12 +1016,17 @@ otherwise) **Extensions:** * 2a. Registered owner does not enter one of the fields - * 2a1. US requests registered owner to fill up all the required fields + * 2a1. US requests registered owner to fill up all the required fields by showing the expected command format. Use case ends. * 2b. Registered owner types incorrect password or username - * 2b1. US requests registered owner to retype their username or password + * 2b1. US requests registered owner to retype their username or password. + + Use case ends. + +* 2c. Registered owner types duplicated fields + * 2c1. US displays an error to registered owner that the field is duplicated. Use case ends. @@ -1137,7 +1142,7 @@ otherwise) * 1a. Logged-in Owner does not specify at least one updated field(s). - * 1a1. US requests Logged-in Owner to specify at least one updated field. + * 1a1. US requests Logged-in Owner to specify at least one updated field by showing the expected command format. Use Case ends. @@ -1197,7 +1202,14 @@ otherwise) - 1a. Logged-in Owner does not specify the required field(s) - - 1a1. CMS requests Logged-in Owner to key in all the fields required to create a customer. + - 1a1. CMS requests Logged-in Owner to key in all the fields required to create a customer by showing the + expected command format. + + Use Case ends. + +- 1b. Logged-in Owner specifies duplicated fields + + - 1b1. CMS displays an error to Logged-in Owner that the field is entered more than once. Use Case ends. @@ -1238,25 +1250,6 @@ otherwise) --- -#### **Use Case: UC09 - Sort customers** - -**System:** Customer Management System (CMS) - -**Actor:** Logged-in owner - -**Preconditions:** Owner is logged in - -**Guarantees** - -* A list of deliveries of a customer is shown if the command is executed successfully. - -**MSS:** - -1. Logged-in Owner types in command to view what deliveries a particular customer has. -2. CMS shows the list of deliveries of that specific customer. - ---- - #### **Use Case: UC09 - Search for a Customer** **System:** Customer Management System (CMS) @@ -1286,13 +1279,13 @@ otherwise) - 1b. No customer with specified keyword is found. - - 1b1. CMS displays a message where no customers with the specified keyword is found. + - 1b1. CMS displays a message where there are no customers found. Use Case ends. - 1c. There are no customers. - - 1c1. CMS displays a message where there are no customers at all. + - 1c1. CMS displays a message where there are no customers found. Use Case ends. From b48273116ce6b2283ed0c84d373595139a6db22a Mon Sep 17 00:00:00 2001 From: zhonghan721 Date: Sun, 12 Nov 2023 12:27:27 +0800 Subject: [PATCH 06/17] Update wording --- docs/DeveloperGuide.md | 42 +++++++++++++++++++++++++++++++----------- 1 file changed, 31 insertions(+), 11 deletions(-) diff --git a/docs/DeveloperGuide.md b/docs/DeveloperGuide.md index ca51dfefa73..9ddca611faf 100644 --- a/docs/DeveloperGuide.md +++ b/docs/DeveloperGuide.md @@ -1015,21 +1015,30 @@ otherwise) **Extensions:** -* 2a. Registered owner does not enter one of the fields - * 2a1. US requests registered owner to fill up all the required fields by showing the expected command format. +* 2a. Registered Owner does not enter one of the fields. + + * 2a1. US displays an error to Registered Owner to fill up all the required fields. Use case ends. -* 2b. Registered owner types incorrect password or username - * 2b1. US requests registered owner to retype their username or password. +* 2b. Registered Owner types incorrect username or password. + + * 2b1. US displays an error to Registered Owner that the username or password is incorrect. Use case ends. -* 2c. Registered owner types duplicated fields - * 2c1. US displays an error to registered owner that the field is duplicated. +* 2c. Registered Owner types duplicated fields. + + * 2c1. US displays an error to Registered Owner that the field is duplicated. Use case ends. +* 2d. Registered Owner specifies values that do not match the field constraint. + + * 2d1. US displays an error to Registered Owner that the value is invalid and shows the constraint. + + Use Case ends. + --- #### Use Case: UC03 - Account Recovery @@ -1176,6 +1185,12 @@ otherwise) Use Case ends. +* 1c. Logged-in Owner specifies values that do not match the field constraint. + + * 1c1. US displays an error to Logged-in Owner that the value is invalid and shows the constraint. + + Use Case ends. + --- #### **Use Case: UC07 - Create Customer** @@ -1200,19 +1215,24 @@ otherwise) **Extensions:** -- 1a. Logged-in Owner does not specify the required field(s) +- 1a. Logged-in Owner does not specify the required field(s). - - 1a1. CMS requests Logged-in Owner to key in all the fields required to create a customer by showing the - expected command format. + - 1a1. CMS displays an error to Logged-in Owner to key in all the fields required to create a customer. Use Case ends. -- 1b. Logged-in Owner specifies duplicated fields +- 1b. Logged-in Owner specifies duplicated fields. - 1b1. CMS displays an error to Logged-in Owner that the field is entered more than once. Use Case ends. +- 1c. Logged-in Owner specifies values that do not match the field constraint. + + - 1c1. CMS displays an error to Logged-in Owner that the value is invalid and shows the constraint. + + Use Case ends. + --- #### **Use Case: UC08 - View customer’s details** @@ -1273,7 +1293,7 @@ otherwise) - 1a. Logged-in Owner does not include any keyword. - - 1a1. CMS requests Logged-in Owner to specify a keyword. + - 1a1. CMS displays an error to Logged-in Owner to specify a keyword. Use Case ends. From 82df9343f9291d20a859c2b3fe90d83b66b43d59 Mon Sep 17 00:00:00 2001 From: Julius Bryan <67666355+juliusgambe@users.noreply.github.com> Date: Sun, 12 Nov 2023 17:28:00 +0800 Subject: [PATCH 07/17] Remove unused constructor --- .../address/model/delivery/Delivery.java | 69 ++++++++----------- 1 file changed, 30 insertions(+), 39 deletions(-) diff --git a/src/main/java/seedu/address/model/delivery/Delivery.java b/src/main/java/seedu/address/model/delivery/Delivery.java index a3cc58f7dc9..a28a1b9d559 100644 --- a/src/main/java/seedu/address/model/delivery/Delivery.java +++ b/src/main/java/seedu/address/model/delivery/Delivery.java @@ -48,29 +48,6 @@ public Delivery(DeliveryName name, Customer customer, OrderDate orderDate, this.note = note; } - - /** - * Constructor for Delivery. - * - * @param deliveryId The ID of the delivery. - * @param name The name of the delivery. - * @param customer The customer who ordered the delivery. - * @param orderDate The date the delivery was ordered. - * @param deliveryDate The date the delivery will be delivered. - * @param status The status of the delivery. - */ - public Delivery(int deliveryId, DeliveryName name, Customer customer, OrderDate orderDate, - DeliveryDate deliveryDate, - DeliveryStatus status) { - Delivery.deliveryCount = Math.max(deliveryCount, deliveryId + 1); - this.deliveryId = deliveryId; - this.name = name; - this.customer = customer; - this.orderDate = orderDate; - this.deliveryDate = deliveryDate; - this.status = status; - } - /** * Constructor for Delivery. * Every field must be present and not null. @@ -169,10 +146,24 @@ public Note getNote() { return note; } + /** + * Sets the delivery count to the specified value. + * + * @param deliveryCount The value to set the delivery count to. + */ public static void setDeliveryCount(int deliveryCount) { Delivery.deliveryCount = deliveryCount; } + /** + * Returns the current delivery count. + * + * @return The current delivery count. + */ + public static int getDeliveryCount() { + return deliveryCount; + } + /** * Returns true if both deliveries have the same identity and data fields. * @@ -185,7 +176,7 @@ public boolean isSameDelivery(Delivery otherDelivery) { } return otherDelivery != null - && otherDelivery.getDeliveryId() == getDeliveryId(); + && otherDelivery.getDeliveryId() == getDeliveryId(); } /** @@ -208,13 +199,13 @@ public boolean equals(Object other) { Delivery otherDelivery = (Delivery) other; return otherDelivery.deliveryId == deliveryId - && otherDelivery.deliveryDate.equals(deliveryDate) - && otherDelivery.name.equals(name) - && otherDelivery.customer.equals(customer) - && Objects.equals(otherDelivery.note, note) - && otherDelivery.orderDate.equals(orderDate) - && otherDelivery.status.equals(status) - && otherDelivery.getAddress().equals(customer.getAddress()); + && otherDelivery.deliveryDate.equals(deliveryDate) + && otherDelivery.name.equals(name) + && otherDelivery.customer.equals(customer) + && Objects.equals(otherDelivery.note, note) + && otherDelivery.orderDate.equals(orderDate) + && otherDelivery.status.equals(status) + && otherDelivery.getAddress().equals(customer.getAddress()); } @Override @@ -225,13 +216,13 @@ public int hashCode() { @Override public String toString() { return new ToStringBuilder(this).add("deliveryId", deliveryId) - .add("name", name) - .add("customer", customer) - .add("orderedAt", orderDate) - .add("deliveredAt", deliveryDate) - .add("address:", customer.getAddress()) - .add("note:", Optional.ofNullable(note) - .map(n -> String.format("\n Note:%s", n)).orElse("")) - .toString(); + .add("name", name) + .add("customer", customer) + .add("orderedAt", orderDate) + .add("deliveredAt", deliveryDate) + .add("address:", customer.getAddress()) + .add("note:", Optional.ofNullable(note) + .map(n -> String.format("\n Note:%s", n)).orElse("")) + .toString(); } } From ab3e3504c9711b5f0d4f9106de11c93418572971 Mon Sep 17 00:00:00 2001 From: Julius Bryan <67666355+juliusgambe@users.noreply.github.com> Date: Sun, 12 Nov 2023 17:28:16 +0800 Subject: [PATCH 08/17] Rename test file --- ...ava => DeliveryListCommandParserTest.java} | 73 ++++++++++++++++++- 1 file changed, 72 insertions(+), 1 deletion(-) rename src/test/java/seedu/address/logic/parser/delivery/{DeliveryListParserTest.java => DeliveryListCommandParserTest.java} (64%) diff --git a/src/test/java/seedu/address/logic/parser/delivery/DeliveryListParserTest.java b/src/test/java/seedu/address/logic/parser/delivery/DeliveryListCommandParserTest.java similarity index 64% rename from src/test/java/seedu/address/logic/parser/delivery/DeliveryListParserTest.java rename to src/test/java/seedu/address/logic/parser/delivery/DeliveryListCommandParserTest.java index d9d832a5657..32b2c687b93 100644 --- a/src/test/java/seedu/address/logic/parser/delivery/DeliveryListParserTest.java +++ b/src/test/java/seedu/address/logic/parser/delivery/DeliveryListCommandParserTest.java @@ -1,5 +1,7 @@ package seedu.address.logic.parser.delivery; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotEquals; import static seedu.address.logic.commands.CommandTestUtil.INVALID_DELIVERY_LIST; import static seedu.address.logic.commands.CommandTestUtil.INVALID_DELIVERY_LIST_ALL; import static seedu.address.logic.commands.CommandTestUtil.INVALID_DELIVERY_LIST_CUSTOMER_ID; @@ -7,6 +9,7 @@ import static seedu.address.logic.commands.CommandTestUtil.INVALID_DELIVERY_LIST_DELIVERY_DATE_MONTH; import static seedu.address.logic.commands.CommandTestUtil.INVALID_DELIVERY_LIST_DELIVERY_DATE_TODAY; import static seedu.address.logic.commands.CommandTestUtil.INVALID_DELIVERY_LIST_SORT; +import static seedu.address.logic.commands.CommandTestUtil.VALID_DELIVERY_DATE_3; import static seedu.address.logic.commands.CommandTestUtil.VALID_DELIVERY_LIST_CANCELLED; import static seedu.address.logic.commands.CommandTestUtil.VALID_DELIVERY_LIST_COMPLETED; import static seedu.address.logic.commands.CommandTestUtil.VALID_DELIVERY_LIST_CREATED; @@ -25,14 +28,16 @@ import seedu.address.logic.Messages; import seedu.address.logic.Sort; import seedu.address.logic.commands.delivery.DeliveryListCommand; +import seedu.address.logic.commands.delivery.DeliveryViewCommand; import seedu.address.logic.parser.CommandParserTestUtil; import seedu.address.logic.parser.DeliveryListParser; import seedu.address.logic.parser.ParserUtil; import seedu.address.model.delivery.Date; +import seedu.address.model.delivery.DeliveryDate; import seedu.address.model.delivery.DeliveryStatus; -public class DeliveryListParserTest { +public class DeliveryListCommandParserTest { private DeliveryListParser parser = new DeliveryListParser(); @@ -70,7 +75,35 @@ public void parse_validArgs_returnsDeliveryListCommand() { CommandParserTestUtil.assertParseSuccess(parser, VALID_DELIVERY_LIST_SORT_DESC, new DeliveryListCommand(null, null, null, Sort.DESC)); + } + @Test + public void parse_duplicateArgs_returnsDeliveryListCommand() { + CommandParserTestUtil.assertParseSuccess(parser, VALID_DELIVERY_LIST_SHIPPED + VALID_DELIVERY_LIST_CANCELLED, + new DeliveryListCommand(DeliveryStatus.CANCELLED, null, null, Sort.DESC)); + CommandParserTestUtil.assertParseSuccess(parser, + VALID_DELIVERY_LIST_DELIVERY_DATE + VALID_DELIVERY_LIST_DELIVERY_DATE, + new DeliveryListCommand(null, null, new DeliveryDate(VALID_DELIVERY_DATE_3), Sort.DESC)); + CommandParserTestUtil.assertParseSuccess(parser, + VALID_DELIVERY_LIST_DELIVERY_DATE + VALID_DELIVERY_LIST_DELIVERY_DATE_TODAY, + new DeliveryListCommand(null, null, new DeliveryDate(LocalDate.now().format( + DateTimeFormatter.ofPattern(Date.FORMAT))), Sort.DESC)); + CommandParserTestUtil.assertParseSuccess(parser, + VALID_DELIVERY_LIST_SHIPPED + VALID_DELIVERY_LIST_CANCELLED + VALID_DELIVERY_LIST_DELIVERY_DATE_TODAY + + VALID_DELIVERY_LIST_DELIVERY_DATE, + new DeliveryListCommand(DeliveryStatus.CANCELLED, null, new DeliveryDate(VALID_DELIVERY_DATE_3), + Sort.DESC)); + + CommandParserTestUtil.assertParseSuccess(parser, + VALID_DELIVERY_LIST_SORT_DESC + VALID_DELIVERY_LIST_SORT_ASC, + new DeliveryListCommand(null, null, null, + Sort.ASC)); + + CommandParserTestUtil.assertParseSuccess(parser, + VALID_DELIVERY_LIST_SHIPPED + VALID_DELIVERY_LIST_CANCELLED + VALID_DELIVERY_LIST_DELIVERY_DATE_TODAY + + VALID_DELIVERY_LIST_DELIVERY_DATE + VALID_DELIVERY_LIST_SORT_DESC + VALID_DELIVERY_LIST_SORT_ASC, + new DeliveryListCommand(DeliveryStatus.CANCELLED, null, new DeliveryDate(VALID_DELIVERY_DATE_3), + Sort.ASC)); } @@ -148,4 +181,42 @@ public void parse_validStatusAndSort_returnsDeliveryListCommand() { CommandParserTestUtil.assertParseSuccess(parser, VALID_DELIVERY_LIST_SHIPPED + VALID_DELIVERY_LIST_SORT_DESC, new DeliveryListCommand(DeliveryStatus.SHIPPED, null, null, Sort.DESC)); } + + @Test + public void equals() { + DeliveryListCommand deliveryListCommand = new DeliveryListCommand(DeliveryStatus.SHIPPED, null, + new Date("2023-12-12"), Sort.ASC); + + // same object -> returns true + assertEquals(deliveryListCommand, deliveryListCommand); + + // same values -> returns true + DeliveryListCommand deliveryListCommandCopy = new DeliveryListCommand(DeliveryStatus.SHIPPED, null, null, + Sort.ASC); + assertEquals(deliveryListCommand, deliveryListCommandCopy); + + // different types -> returns false + assertNotEquals(deliveryListCommand, new DeliveryViewCommand(1)); + + // null -> returns false + assertNotEquals(deliveryListCommand, null); + + // different status -> returns false + DeliveryListCommand differentDeliveryListCommand = new DeliveryListCommand(DeliveryStatus.CANCELLED, null, + null, Sort.ASC); + assertNotEquals(deliveryListCommand, differentDeliveryListCommand); + + // different sort -> returns false + differentDeliveryListCommand = new DeliveryListCommand(DeliveryStatus.SHIPPED, null, null, Sort.DESC); + assertNotEquals(deliveryListCommand, differentDeliveryListCommand); + + // different customer id -> returns false + differentDeliveryListCommand = new DeliveryListCommand(DeliveryStatus.SHIPPED, 1, null, Sort.ASC); + assertNotEquals(deliveryListCommand, differentDeliveryListCommand); + + // different delivery date -> returns false + differentDeliveryListCommand = new DeliveryListCommand(DeliveryStatus.SHIPPED, null, + new Date("2024-12-12"), Sort.ASC); + assertNotEquals(deliveryListCommand, differentDeliveryListCommand); + } } From f7b1bc180e28b84ddfaf120153f6fe2f5d924faf Mon Sep 17 00:00:00 2001 From: Julius Bryan <67666355+juliusgambe@users.noreply.github.com> Date: Sun, 12 Nov 2023 17:28:25 +0800 Subject: [PATCH 09/17] Add more tests --- .../delivery/DeliveryListCommandTest.java | 105 +++++++++--------- .../address/model/delivery/DeliveryTest.java | 24 +++- 2 files changed, 73 insertions(+), 56 deletions(-) diff --git a/src/test/java/seedu/address/logic/commands/delivery/DeliveryListCommandTest.java b/src/test/java/seedu/address/logic/commands/delivery/DeliveryListCommandTest.java index 3f55f40e7b7..83a75d90b1b 100644 --- a/src/test/java/seedu/address/logic/commands/delivery/DeliveryListCommandTest.java +++ b/src/test/java/seedu/address/logic/commands/delivery/DeliveryListCommandTest.java @@ -28,123 +28,128 @@ public class DeliveryListCommandTest { @Test public void execute_listIsNotFiltered_showsSameList() { assertCommandListSuccess(new DeliveryListCommand(null, null, null, null), model, - DeliveryListCommand.MESSAGE_SUCCESS, model); + DeliveryListCommand.MESSAGE_SUCCESS, model); } + @Test public void execute_listIsFiltered_showsEverything() { + + assertCommandListSuccess(new DeliveryListCommand(null, null, null, null), + model, DeliveryListCommand.MESSAGE_SUCCESS, model); + assertCommandListSuccess(new DeliveryListCommand(DeliveryStatus.CREATED, null, null, null), model, - DeliveryListCommand.MESSAGE_SUCCESS, model); + DeliveryListCommand.MESSAGE_SUCCESS, model); assertCommandListSuccess(new DeliveryListCommand(DeliveryStatus.SHIPPED, null, null, null), model, - DeliveryListCommand.MESSAGE_SUCCESS, model); + DeliveryListCommand.MESSAGE_SUCCESS, model); assertCommandListSuccess(new DeliveryListCommand(DeliveryStatus.COMPLETED, null, null, null), model, - DeliveryListCommand.MESSAGE_SUCCESS, - model); + DeliveryListCommand.MESSAGE_SUCCESS, + model); assertCommandListSuccess(new DeliveryListCommand(DeliveryStatus.CANCELLED, null, null, null), model, - DeliveryListCommand.MESSAGE_SUCCESS, model); + DeliveryListCommand.MESSAGE_SUCCESS, model); // customer id assertCommandListSuccess(new DeliveryListCommand(DeliveryStatus.COMPLETED, 2, null, null), model, - DeliveryListCommand.MESSAGE_SUCCESS, model); + DeliveryListCommand.MESSAGE_SUCCESS, model); assertCommandListSuccess(new DeliveryListCommand(DeliveryStatus.COMPLETED, 2, null, null), model, - DeliveryListCommand.MESSAGE_SUCCESS, model); + DeliveryListCommand.MESSAGE_SUCCESS, model); // expected delivery date assertCommandListSuccess( - new DeliveryListCommand(DeliveryStatus.COMPLETED, null, new DeliveryDate(VALID_DELIVERY_DATE_3), null), - model, - DeliveryListCommand.MESSAGE_SUCCESS, model); + new DeliveryListCommand(DeliveryStatus.COMPLETED, null, new DeliveryDate(VALID_DELIVERY_DATE_3), null), + model, + DeliveryListCommand.MESSAGE_SUCCESS, model); } @Test public void execute_listIsFiltered_empty() { assertCommandListSuccess( - new DeliveryListCommand(DeliveryStatus.CREATED, 1, new DeliveryDate("2001-12-12"), null), model, - DeliveryListCommand.MESSAGE_EMPTY, model); + new DeliveryListCommand(DeliveryStatus.CREATED, 1, new DeliveryDate("2001-12-12"), null), model, + DeliveryListCommand.MESSAGE_EMPTY, model); assertCommandListSuccess( - new DeliveryListCommand(DeliveryStatus.SHIPPED, 1, new DeliveryDate("2001-12-12"), null), model, - DeliveryListCommand.MESSAGE_EMPTY, model); + new DeliveryListCommand(DeliveryStatus.SHIPPED, 1, new DeliveryDate("2001-12-12"), null), model, + DeliveryListCommand.MESSAGE_EMPTY, model); assertCommandListSuccess( - new DeliveryListCommand(DeliveryStatus.COMPLETED, 1, new DeliveryDate("2001-12-12"), null), model, - DeliveryListCommand.MESSAGE_EMPTY, model); + new DeliveryListCommand(DeliveryStatus.COMPLETED, 1, new DeliveryDate("2001-12-12"), null), model, + DeliveryListCommand.MESSAGE_EMPTY, model); assertCommandListSuccess( - new DeliveryListCommand(DeliveryStatus.CANCELLED, 1, new DeliveryDate("2001-12-12"), null), model, - DeliveryListCommand.MESSAGE_EMPTY, model); + new DeliveryListCommand(DeliveryStatus.CANCELLED, 1, new DeliveryDate("2001-12-12"), null), model, + DeliveryListCommand.MESSAGE_EMPTY, model); } @Test public void execute_listIsFilteredAndSortedAscending_showsSameList() { assertCommandListSuccess(new DeliveryListCommand(DeliveryStatus.CREATED, null, null, Sort.ASC), model, - DeliveryListCommand.MESSAGE_SUCCESS, model); + DeliveryListCommand.MESSAGE_SUCCESS, model); assertCommandListSuccess(new DeliveryListCommand(DeliveryStatus.SHIPPED, 2, null, Sort.ASC), model, - DeliveryListCommand.MESSAGE_SUCCESS, model); + DeliveryListCommand.MESSAGE_SUCCESS, model); assertCommandListSuccess( - new DeliveryListCommand(DeliveryStatus.COMPLETED, 2, new DeliveryDate(VALID_DELIVERY_DATE_3), Sort.ASC), - model, - DeliveryListCommand.MESSAGE_SUCCESS, - model); + new DeliveryListCommand(DeliveryStatus.COMPLETED, 2, new DeliveryDate(VALID_DELIVERY_DATE_3), Sort.ASC), + model, + DeliveryListCommand.MESSAGE_SUCCESS, + model); assertCommandListSuccess(new DeliveryListCommand(DeliveryStatus.CANCELLED, null, null, Sort.ASC), model, - DeliveryListCommand.MESSAGE_SUCCESS, model); + DeliveryListCommand.MESSAGE_SUCCESS, model); } @Test public void execute_listIsSortedAscending_showsSameList() { assertCommandListSuccess(new DeliveryListCommand(null, null, null, Sort.ASC), model, - DeliveryListCommand.MESSAGE_SUCCESS, - model); + DeliveryListCommand.MESSAGE_SUCCESS, + model); } @Test public void execute_listIsSortedDescending_showsSameList() { assertCommandListSuccess(new DeliveryListCommand(null, null, null, Sort.DESC), model, - DeliveryListCommand.MESSAGE_SUCCESS, - model); + DeliveryListCommand.MESSAGE_SUCCESS, + model); } @Test public void execute_listIsNotFilteredLoggedOut_throwsCommandException() { model.setLogoutSuccess(); assertCommandFailure(new DeliveryListCommand(null, null, null, null), model, - Messages.MESSAGE_USER_NOT_AUTHENTICATED); + Messages.MESSAGE_USER_NOT_AUTHENTICATED); } @Test public void execute_listIsFilteredLoggedOut_throwsCommandException() { model.setLogoutSuccess(); assertCommandFailure(new DeliveryListCommand(DeliveryStatus.CREATED, null, null, null), model, - Messages.MESSAGE_USER_NOT_AUTHENTICATED); + Messages.MESSAGE_USER_NOT_AUTHENTICATED); assertCommandFailure(new DeliveryListCommand(DeliveryStatus.SHIPPED, null, null, null), model, - Messages.MESSAGE_USER_NOT_AUTHENTICATED); + Messages.MESSAGE_USER_NOT_AUTHENTICATED); assertCommandFailure(new DeliveryListCommand(DeliveryStatus.COMPLETED, null, null, null), model, - Messages.MESSAGE_USER_NOT_AUTHENTICATED); + Messages.MESSAGE_USER_NOT_AUTHENTICATED); assertCommandFailure(new DeliveryListCommand(DeliveryStatus.CANCELLED, null, null, null), model, - Messages.MESSAGE_USER_NOT_AUTHENTICATED); + Messages.MESSAGE_USER_NOT_AUTHENTICATED); } @Test public void execute_listIsFilteredAndSortedAscendingLoggedOut_throwsCommandException() { model.setLogoutSuccess(); assertCommandFailure(new DeliveryListCommand(DeliveryStatus.CREATED, null, null, Sort.ASC), model, - Messages.MESSAGE_USER_NOT_AUTHENTICATED); + Messages.MESSAGE_USER_NOT_AUTHENTICATED); assertCommandFailure(new DeliveryListCommand(DeliveryStatus.SHIPPED, null, null, Sort.ASC), model, - Messages.MESSAGE_USER_NOT_AUTHENTICATED); + Messages.MESSAGE_USER_NOT_AUTHENTICATED); assertCommandFailure(new DeliveryListCommand(DeliveryStatus.COMPLETED, null, null, Sort.ASC), model, - Messages.MESSAGE_USER_NOT_AUTHENTICATED); + Messages.MESSAGE_USER_NOT_AUTHENTICATED); assertCommandFailure(new DeliveryListCommand(DeliveryStatus.CANCELLED, null, null, Sort.ASC), model, - Messages.MESSAGE_USER_NOT_AUTHENTICATED); + Messages.MESSAGE_USER_NOT_AUTHENTICATED); } @Test public void execute_listIsSortedAscendingLoggedOut_throwsCommandException() { model.setLogoutSuccess(); assertCommandFailure(new DeliveryListCommand(null, null, null, Sort.ASC), model, - Messages.MESSAGE_USER_NOT_AUTHENTICATED); + Messages.MESSAGE_USER_NOT_AUTHENTICATED); } @Test public void execute_listIsSortedDescendingLoggedOut_throwsCommandException() { model.setLogoutSuccess(); assertCommandFailure(new DeliveryListCommand(null, null, null, Sort.DESC), model, - Messages.MESSAGE_USER_NOT_AUTHENTICATED); + Messages.MESSAGE_USER_NOT_AUTHENTICATED); } @@ -153,21 +158,21 @@ public void equals() { DeliveryListCommand deliveryListCommand = new DeliveryListCommand(null, null, null, null); DeliveryListCommand deliveryListCommand1 = new DeliveryListCommand(DeliveryStatus.CREATED, null, null, null); DeliveryListCommand deliveryListCommand2 = new DeliveryListCommand(DeliveryStatus.CREATED, null, null, - Sort.ASC); + Sort.ASC); DeliveryListCommand deliveryListCommand3 = new DeliveryListCommand(DeliveryStatus.CREATED, null, null, - Sort.DESC); + Sort.DESC); DeliveryListCommand deliveryListCommand4 = new DeliveryListCommand(DeliveryStatus.COMPLETED, null, null, - Sort.ASC); + Sort.ASC); DeliveryListCommand deliveryListCommand5 = new DeliveryListCommand(DeliveryStatus.COMPLETED, 1, null, - Sort.ASC); + Sort.ASC); DeliveryListCommand deliveryListCommand6 = new DeliveryListCommand(DeliveryStatus.COMPLETED, 2, null, - Sort.ASC); + Sort.ASC); DeliveryListCommand deliveryListCommand7 = new DeliveryListCommand(DeliveryStatus.COMPLETED, 1, - new DeliveryDate(VALID_DELIVERY_DATE_1), - Sort.ASC); + new DeliveryDate(VALID_DELIVERY_DATE_1), + Sort.ASC); DeliveryListCommand deliveryListCommand8 = new DeliveryListCommand(DeliveryStatus.COMPLETED, 1, - new DeliveryDate(VALID_DELIVERY_DATE_2), - Sort.ASC); + new DeliveryDate(VALID_DELIVERY_DATE_2), + Sort.ASC); // same object -> returns true assertTrue(deliveryListCommand.equals(deliveryListCommand)); diff --git a/src/test/java/seedu/address/model/delivery/DeliveryTest.java b/src/test/java/seedu/address/model/delivery/DeliveryTest.java index d1e7c848145..b77516f80fc 100644 --- a/src/test/java/seedu/address/model/delivery/DeliveryTest.java +++ b/src/test/java/seedu/address/model/delivery/DeliveryTest.java @@ -1,5 +1,6 @@ package seedu.address.model.delivery; +import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; import static seedu.address.testutil.TypicalDeliveries.GABRIELS_MILK; @@ -13,6 +14,7 @@ public class DeliveryTest { + @Test public void deliveryId_success() { Delivery delivery = new DeliveryBuilder().autoBuild(); @@ -29,6 +31,16 @@ public void deliveryId_failure() { assertFalse(delivery.getDeliveryId() == delivery1.getDeliveryId()); } + @Test + public void setDeliveryCount_success() { + Delivery delivery = new DeliveryBuilder().autoBuild(); + Delivery delivery1 = new DeliveryBuilder().autoBuild(); + Delivery delivery2 = new DeliveryBuilder().autoBuild(); + + Delivery.setDeliveryCount(1); + assertEquals(1, Delivery.getDeliveryCount()); + } + @Test public void setOrderDate() { Delivery delivery = new DeliveryBuilder().autoBuild(); @@ -100,8 +112,8 @@ public void isSameDelivery() { // different id, all other attributes different -> returns false editedGabrielsMilk = new DeliveryBuilder(GABRIELS_MILK).withName("Gabriel Milk Updated") - .withStatus(DeliveryStatus.COMPLETED).withCustomer(TypicalCustomers.BOB).withOrderDate("2019-12-12") - .withDeliveryDate("2024-12-12").autoBuild(); + .withStatus(DeliveryStatus.COMPLETED).withCustomer(TypicalCustomers.BOB).withOrderDate("2019-12-12") + .withDeliveryDate("2024-12-12").autoBuild(); assertFalse(GABRIELS_MILK.isSameDelivery(editedGabrielsMilk)); } @@ -145,13 +157,13 @@ public void equals() { // same id, different attributes -> returns false editedGabrielsMilk = new DeliveryBuilder(GABRIELS_MILK).withName("Gabriel Milk Updated") - .withStatus(DeliveryStatus.COMPLETED).withCustomer(TypicalCustomers.BOB).build(); + .withStatus(DeliveryStatus.COMPLETED).withCustomer(TypicalCustomers.BOB).build(); assertFalse(GABRIELS_MILK.equals(editedGabrielsMilk)); // different id, all other attributes different -> returns false editedGabrielsMilk = new DeliveryBuilder(GABRIELS_MILK).withName("Gabriel Milk Updated") - .withStatus(DeliveryStatus.COMPLETED).withCustomer(TypicalCustomers.BOB).withOrderDate("2019-12-12") - .withDeliveryDate("2024-12-12").autoBuild(); + .withStatus(DeliveryStatus.COMPLETED).withCustomer(TypicalCustomers.BOB).withOrderDate("2019-12-12") + .withDeliveryDate("2024-12-12").autoBuild(); assertFalse(GABRIELS_MILK.isSameDelivery(editedGabrielsMilk)); // different delivery address, all other attributes same -> returns false @@ -168,7 +180,7 @@ public void equals() { // different delivery note, all other attributes same -> returns false editedGabrielsMilk = new DeliveryBuilder(GABRIELS_MILK).withNote( - "Different note").build(); + "Different note").build(); assertFalse(GABRIELS_MILK.equals(editedGabrielsMilk)); } } From 92b705b7fcc50d7aa9f24acb6c6787536cf3a493 Mon Sep 17 00:00:00 2001 From: zhonghan721 Date: Sun, 12 Nov 2023 21:02:35 +0800 Subject: [PATCH 10/17] Fix typo --- docs/DeveloperGuide.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/DeveloperGuide.md b/docs/DeveloperGuide.md index 730101dbb51..ec6fbf791a6 100644 --- a/docs/DeveloperGuide.md +++ b/docs/DeveloperGuide.md @@ -567,7 +567,7 @@ The sequence of the `logout` command is as follows: by calling `Model#getUserLoginStatus`. 3. If the user is currently logged in, the `userLogoutCommand` calls `Model#setLogoutSuccess`, changing the login status to false and restricting the user access to most commands. -4. The `userLoginCommand` also calls `Model#clearFilteredDeliveryList` and `Model#clearFilteredCustomerList` +4. The `userLogoutCommand` also calls `Model#clearFilteredDeliveryList` and `Model#clearFilteredCustomerList` to hide the list of deliveries and customers. The following sequence diagram shows how the `logout` command works: From f3c78330d5d8c2f31eeb9d3c91a7602e419d73c7 Mon Sep 17 00:00:00 2001 From: Gabriel4357 Date: Sun, 12 Nov 2023 22:06:47 +0800 Subject: [PATCH 11/17] Update use cases in DG --- docs/DeveloperGuide.md | 210 ++++++++--------------------------------- 1 file changed, 37 insertions(+), 173 deletions(-) diff --git a/docs/DeveloperGuide.md b/docs/DeveloperGuide.md index f13d56fbb59..11c41ed8bc5 100644 --- a/docs/DeveloperGuide.md +++ b/docs/DeveloperGuide.md @@ -876,17 +876,17 @@ Priorities: High (must have) - `***`, Medium (nice to have) - `**`, Low (unlikel | `***` | a registered owner | view a customer | I can see their detailed information. | | `***` | a registered owner | see a customer's list of deliveries | I can easily see all the deliveries of a certain customer. | | `***` | a registered owner | quickly search for the details of a client | I can monitor the progress of an order efficiently and effectively. | -| `***` | a registered owner | update a customer | I can change details if keyed in wrongly. | +| `***` | a registered owner | update a customer's details | I can change details if keyed in wrongly. | | `***` | a registered owner | delete a customer | I can remove redundant or incorrect customer records, especially when unforeseen errors occur. | | `***` | a registered owner | view a list of customers | I can have a comprehensive overview of my customer base. | | `***` | a registered owner | create a delivery | I can efficiently organise and access delivery information. | | `***` | a registered owner | create notes about deliveries | I can add additional information about deliveries. | | `***` | a registered owner | view a list of deliveries | I can see a comprehensive overview of my deliveries. | | `***` | a registered owner | see the list of deliveries that would be delivered for the day | I can prioritise particular orders. | -| `***` | a registered owner | add a customer to a delivery | I know who the delivery is for. | +| `***` | a registered owner | add a customer to a delivery | I can know who the delivery is for. | | `***` | a registered owner | quickly search for the name of a delivery | I can monitor the progress of delivery. | -| `***` | a registered owner | see a list of deliveries sorted by their expected date of delivery | It more organised and easier for me to get an overview of all orders. | -| `***` | a registered owner | view the details of a delivery | I know what the order is and where to deliver it to. | +| `***` | a registered owner | see a list of deliveries sorted by their expected date of delivery | I can see a more organised list and easier for me to get an overview of all orders. | +| `***` | a registered owner | view the details of a delivery | I can know what the order is and where to deliver it to. | | `***` | a registered owner | update the status of the delivery | I can keep track of the delivery progress and notify my client. | | `***` | a registered owner | update delivery details | I can change any information if there was an error from user/me. | | `***` | a registered owner | delete a delivery | I can get rid of deliveries that are redundant. | @@ -1318,21 +1318,21 @@ otherwise) **Extensions:** -- 1a. Logged-in Owner does not specify at least one updated field(s). +- 1a. Logged-in owner did not specify at least one field to update. - - 1a1. CMS displays an error to Logged-in Owner to specify at least one field to update. + - 1a1. CMS informs the Logged-in Owner to specify at least one field to update. Use Case Ends. -- 1b. Logged-in Owner specifies invalid customer. +- 1b. Logged-in Owner specified a Customer ID that does not exist. - - 1b1. CMS displays an error to Logged-in Owner that the specified customer does not exist. + - 1b1. CMS informs the Logged-in Owner of invalid Customer ID being entered. Use Case Ends. -- 1c. Logged-in Owner does not specify customer. +- 1c. Logged-in Owner did not specify a Customer ID. - - 1c1. CMS displays an error to Logged-in Owner to specify a customer to update. + - 1c1. CMS informs the Logged-in Owner to specify a Customer to update. Use Case Ends. @@ -1415,21 +1415,27 @@ otherwise) **Extensions:** -- 1a. Command has missing fields. +- 1a. Logged-in Owner did not specify all required fields. - - 1a1. DMS displays an error to Logged-in Owner to specify all required fields. + - 1a1. DMS informs the Logged-in Owner to specify all required fields. Use Case Ends. -- 1b. Command has invalid date. +- 1b. Logged-in Owner specified an invalid Expected Delivery date. - - 1b1. DMS displays an error to Logged-in Owner that an invalid date was given. + - 1b1. DMS informs the Logged-in Owner that an Invalid date was given. Use Case Ends. -- 1c. Command has invalid date format. +- 1c. Logged-in Owner specified an invalid date format. + + - 1c1. DMS informs the Logged-in Owner to specify the date in a valid format. + + Use Case Ends. + +- 1d. Logged-in Owner specfied a Customer ID that does not exist. - - 1c1. DMS displays an error to Logged-in Owner to specify the date in a valid format. + - 1d1. DMS informs the Logged-in Owner of invalid Customer ID being entered. Use Case Ends. @@ -1557,109 +1563,7 @@ otherwise) --- -#### **Use case:** UC17 - Add Customer to Delivery - -**System:** Delivery Management System (DMS) -**Actor:** Logged-in owner. - -**Preconditions:** Owner is logged in. - -**Guarantees:** - -- A customer is added to a delivery only if the command is executed successfully. - -**MSS:** - -1. Logged-in Owner types command to add a customer to a delivery. -2. DMS shows success message. - - Use Case Ends. - -**Extensions:** - -- 1a. Command has missing fields. - - - 1a1. DMS displays an error to Logged-in Owner to specify all required fields. - - Use Case Ends. - -- 1b. Command has invalid customer details. - - - 1b1. DMS displays an error to Logged-in Owner that the specified customer details is invalid. - - Use Case Ends. - ---- - -#### **Use case:** UC18 - Remove Customer from Delivery - -**System:** Delivery Management System (DMS) -**Actor:** Logged-in owner. - -**Preconditions:** Owner is logged in. - -**Guarantees:** - -- A customer is removed from a delivery only if the command is executed successfully. - -**MSS:** - -1. Logged-in Owner types command to remove a customer from a delivery. -2. DMS shows success message. - - Use Case Ends. - -**Extensions:** - -- 1a. Command has missing fields. - - - 1a1. DMS displays an error to Logged-in Owner to specify all required fields. - - Use Case Ends. - -- 1b. Command has invalid customer details. - - - 1b1. DMS displays an error to Logged-in Owner that the specified customer cannot be found. - - Use Case Ends. - ---- - -#### **Use case:** UC19 - Specify Delivery Method - -**System:** Delivery Management System (DMS) -**Actor:** Logged-in owner. - -**Preconditions:** Owner is logged in. - -**Guarantees:** - -- A delivery method is specified only if the command is executed successfully. - -**MSS:** - -1. Logged-in Owner types command to specify a delivery method. -2. DMS shows success message. - - Use Case Ends. - -**Extensions:** - -- 1a. Command has missing fields. - - - 1a1. DMS displays an error to Logged-in Owner to specify all required fields. - - Use Case Ends. - -- 1b. Command has invalid delivery options. - - - 1b1. DMS displays an error to Logged-in Owner that the specified delivery method is invalid. - - Use Case Ends. - ---- - -#### **Use case:** UC20 - Search for Delivery +#### **Use case:** UC17 - Search for Delivery **System:** Delivery Management System (DMS) **Actor:** Logged-in owner. @@ -1687,42 +1591,7 @@ otherwise) --- -#### Use Case: UC21 - View location of delivery - -**System:** Delivery Management System (DMS) - -**Actor:** Logged-in owner. - -**Preconditions:** Owner is logged-in. - -**Guarantees:** - -- Delivery location is shown only if the command is executed successfully. - -**MSS:** - -1. Logged-in owner types command to view location of delivery. -2. DMS displays the address of the customer associated with the delivery. - - Use case ends. - -**Extensions** - -- 1a. Logged-in owner did not specify the delivery id. - - - 1a1. DMS informs the logged-in owner of the missing field. - - Use case ends. - -- 1b. Logged-in owner specified a delivery id that does not exist. - - - 1b1. DMS informs the logged-in owner of invalid delivery id being entered. - - Use case ends. - ---- - -#### Use Case: UC22 - View details of delivery +#### Use Case: UC18 - View details of delivery **System:** Delivery Management System (DMS) @@ -1757,7 +1626,7 @@ otherwise) --- -#### Use Case: UC23 - Update delivery status +#### Use Case: UC19 - Update delivery status **System:** Delivery Management System (DMS) @@ -1798,7 +1667,7 @@ otherwise) --- -#### Use Case: UC24 - Update delivery details +#### Use Case: UC20 - Update delivery details **System:** Delivery Management System (DMS) @@ -1819,27 +1688,27 @@ otherwise) **Extensions** -- 1a. Logged-in owner did not specify all the fields. +- 1a. Logged-in owner did not specify at least one field to update. - - 1a1. DMS informs the logged-in owner to specify all the fields. + - 1a1. DMS informs the Logged-in Owner to specify at least one field to update. Use case ends. -- 1b. Logged-in owner specified a delivery id that does not exist. +- 1b. Logged-in owner specified a Delivery ID that does not exist. - - 1b1. DMS informs the logged-in owner of invalid delivery id being entered. + - 1b1. DMS informs the logged-in owner of Invalid delivery id being entered. Use case ends. -- 1c. Logged-in owner entered date in the wrong format. +- 1c. Logged-in owner did not specifiy a Delivery ID. - - 1c1. DMS informs the logged-in owner of invalid format and shows the correct format. + - 1c1. DMS informs the logged-in Owner to specify a Delivery to update. Use case ends --- -#### Use Case: UC25 - Delete delivery +#### Use Case: UC21 - Delete delivery **System:** Delivery Management System (DMS) @@ -1860,23 +1729,18 @@ otherwise) **Extensions** -- 1a. Logged-in owner did not specify the delivery id. +- 1a. Logged-in owner did not specify the Delivery ID. - - 1a1. DMS informs the logged-in owner of the missing field. + - 1a1. DMS informs the Logged-in Owner to specify a Delivery to delete. Use case ends. -- 1b. Logged-in owner specified a delivery id that does not exist. +- 1b. Logged-in owner specified a Delivery ID that does not exist. - - 1b1. DMS informs the logged-in owner of invalid delivery id being entered. + - 1b1. DMS informs the logged-in owner of Invalid Delivery ID being entered. Use case ends. -- 1c. Logged-in owner specified a delivery that is in-progress. - - - 1c1. DMS informs the logged-in owner of the status of the delivery and does not delete it. - - Use case ends --- From 76889c644a423162484c4238957c2ec35efc5344 Mon Sep 17 00:00:00 2001 From: Julius Bryan <67666355+juliusgambe@users.noreply.github.com> Date: Sun, 12 Nov 2023 22:33:19 +0800 Subject: [PATCH 12/17] Remove null --- .../delivery/DeliveryListCommandParserTest.java | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/test/java/seedu/address/logic/parser/delivery/DeliveryListCommandParserTest.java b/src/test/java/seedu/address/logic/parser/delivery/DeliveryListCommandParserTest.java index 32b2c687b93..4ff9c90519d 100644 --- a/src/test/java/seedu/address/logic/parser/delivery/DeliveryListCommandParserTest.java +++ b/src/test/java/seedu/address/logic/parser/delivery/DeliveryListCommandParserTest.java @@ -184,14 +184,15 @@ public void parse_validStatusAndSort_returnsDeliveryListCommand() { @Test public void equals() { - DeliveryListCommand deliveryListCommand = new DeliveryListCommand(DeliveryStatus.SHIPPED, null, + DeliveryListCommand deliveryListCommand = new DeliveryListCommand(DeliveryStatus.SHIPPED, 1, new Date("2023-12-12"), Sort.ASC); // same object -> returns true assertEquals(deliveryListCommand, deliveryListCommand); // same values -> returns true - DeliveryListCommand deliveryListCommandCopy = new DeliveryListCommand(DeliveryStatus.SHIPPED, null, null, + DeliveryListCommand deliveryListCommandCopy = new DeliveryListCommand(DeliveryStatus.SHIPPED, 1, + new Date("2023-12-12"), Sort.ASC); assertEquals(deliveryListCommand, deliveryListCommandCopy); @@ -202,20 +203,22 @@ public void equals() { assertNotEquals(deliveryListCommand, null); // different status -> returns false - DeliveryListCommand differentDeliveryListCommand = new DeliveryListCommand(DeliveryStatus.CANCELLED, null, - null, Sort.ASC); + DeliveryListCommand differentDeliveryListCommand = new DeliveryListCommand(DeliveryStatus.CANCELLED, 1, + new Date("2023-12-12"), Sort.ASC); assertNotEquals(deliveryListCommand, differentDeliveryListCommand); // different sort -> returns false - differentDeliveryListCommand = new DeliveryListCommand(DeliveryStatus.SHIPPED, null, null, Sort.DESC); + differentDeliveryListCommand = new DeliveryListCommand(DeliveryStatus.SHIPPED, 1, new Date("2023-12-12"), + Sort.DESC); assertNotEquals(deliveryListCommand, differentDeliveryListCommand); // different customer id -> returns false - differentDeliveryListCommand = new DeliveryListCommand(DeliveryStatus.SHIPPED, 1, null, Sort.ASC); + differentDeliveryListCommand = new DeliveryListCommand(DeliveryStatus.SHIPPED, 2, new Date("2023-12-12"), + Sort.ASC); assertNotEquals(deliveryListCommand, differentDeliveryListCommand); // different delivery date -> returns false - differentDeliveryListCommand = new DeliveryListCommand(DeliveryStatus.SHIPPED, null, + differentDeliveryListCommand = new DeliveryListCommand(DeliveryStatus.SHIPPED, 1, new Date("2024-12-12"), Sort.ASC); assertNotEquals(deliveryListCommand, differentDeliveryListCommand); } From 971e5f6001ee59ff095c33c225a856a852213988 Mon Sep 17 00:00:00 2001 From: Julius Bryan <67666355+juliusgambe@users.noreply.github.com> Date: Sun, 12 Nov 2023 22:45:20 +0800 Subject: [PATCH 13/17] Remove extra extensions --- docs/DeveloperGuide.md | 69 +++++++++--------------------------------- 1 file changed, 15 insertions(+), 54 deletions(-) diff --git a/docs/DeveloperGuide.md b/docs/DeveloperGuide.md index 9a91a8cba6d..c3e4bda2cfc 100644 --- a/docs/DeveloperGuide.md +++ b/docs/DeveloperGuide.md @@ -1487,7 +1487,7 @@ otherwise) - 1a. User specifies status field in command. - - 1a1. DMS display a list of deliveries filtered with the specified status. + - 1a1. DMS displays a list of deliveries filtered with the specified status. Use Case Ends. @@ -1509,82 +1509,43 @@ otherwise) Use Case Ends. -- 1e. User specifies both status and customer fields. +- 1e. User specifies a sort field in command. - - 1e1. DMS displays a list of deliveries filtered by the specified status and customer. + - 1e1. DMS displays a list of all deliveries sorted by the specified sort order. Use Case Ends. -- 1f. User specifies both status and expected delivery date fields. +- 1f. User specifies a combination of the filter fields and sort field. - - 1f1. DMS displays a list of deliveries filtered by the specified status and expected delivery date. + - 1f1. DMS displays a list of deliveries filtered by the specified filters and sorted by the specified sort + order. Use Case Ends. -- 1g. User specifies both status and expected delivery date fields as "TODAY". +- 1g. User specifies duplicate fields - - 1g1. DMS displays a list of deliveries filtered by the specified status and expected delivery date that is today's - date. + - 1g1. DMS displays a list of deliveries filtered by the last occurrence of each specified filters and sorted by the + last specified sort Use Case Ends. +- 1h. Logged-in Owner specifies invalid status. -- 1h. User specifies both customer and expected delivery date fields. - - - 1h1. DMS displays a list of deliveries filtered by the specified customer and expected delivery date. - - Use Case Ends. - -- 1i. User specifies both customer and expected delivery date fields as "TODAY". - - - 1i1. DMS displays a list of deliveries filtered by the specified customer and expected delivery date that is - today's date. - - Use Case Ends. - -- 1j. User specifies customer, expected delivery date and status fields. - - - 1j1. DMS displays a list of deliveries filtered by the specified customer, expected delivery date and status. - - Use Case Ends. - -- 1k. User specifies customer, expected delivery date as "TODAY" and status fields. - - - 1k1. DMS displays a list of deliveries filtered by the specified customer, expected delivery date that is today's - date and status. - - Use Case Ends. - -- 1l. User specifies sort field in command. - - - 1l1. DMS displays a list of all deliveries sorted by the specified sort order. - - Use Case Ends. - -- 1m. User Specifies any of the filter fields and sort field. - - - 1m1. DMS displays a list of deliveries filtered by the specified filters and then expected delivery date sorted - by the specified sort order. - - Use Case Ends. - -- 1n. Logged-in Owner specifies invalid status. - - - 1n1. DMS displays an error to Logged-in Owner that the specified status is invalid and state the possible accepted + - 1h1. DMS displays an error to Logged-in Owner that the specified status is invalid and state the possible accepted status values. Use Case Ends. -- 1o. Logged-in Owner specifies an invalid date. +- 1i. Logged-in Owner specifies an invalid date. - - 1o1. DMS displays an error to Logged-in Owner that the specified date is in an invalid format and states what + - 1i1. DMS displays an error to Logged-in Owner that the specified date is in an invalid format and states what format it should be in. Use Case Ends. -- 1p. Logged-in Owner specifies an invalid sort. +- 1j. Logged-in Owner specifies an invalid sort. - - 1p1. DMS displays an error to Logged-in Owner that the specified sort is invalid and state the possible accepted + - 1j1. DMS displays an error to Logged-in Owner that the specified sort is invalid and state the possible accepted values. Use Case Ends. From 577f7211c5accb8e051d0a0bfefac25a9b263f03 Mon Sep 17 00:00:00 2001 From: Julius Bryan <67666355+juliusgambe@users.noreply.github.com> Date: Mon, 13 Nov 2023 00:28:25 +0800 Subject: [PATCH 14/17] Fix imports --- .../logic/parser/delivery/DeliveryListCommandParserTest.java | 1 - 1 file changed, 1 deletion(-) diff --git a/src/test/java/seedu/address/logic/parser/delivery/DeliveryListCommandParserTest.java b/src/test/java/seedu/address/logic/parser/delivery/DeliveryListCommandParserTest.java index 67053137c31..727e798a5f6 100644 --- a/src/test/java/seedu/address/logic/parser/delivery/DeliveryListCommandParserTest.java +++ b/src/test/java/seedu/address/logic/parser/delivery/DeliveryListCommandParserTest.java @@ -30,7 +30,6 @@ import seedu.address.logic.commands.delivery.DeliveryListCommand; import seedu.address.logic.commands.delivery.DeliveryViewCommand; import seedu.address.logic.parser.CommandParserTestUtil; -import seedu.address.logic.parser.DeliveryListParser; import seedu.address.logic.parser.ParserUtil; import seedu.address.model.delivery.Date; import seedu.address.model.delivery.DeliveryDate; From 8c479934afabb61e2fdd254a5d9cd9f6e61c8b6f Mon Sep 17 00:00:00 2001 From: Julius Bryan <67666355+juliusgambe@users.noreply.github.com> Date: Mon, 13 Nov 2023 11:27:25 +0800 Subject: [PATCH 15/17] Add overflow error --- .../customer/CustomerDeleteCommand.java | 14 ++++----- .../customer/CustomerEditCommand.java | 24 ++++++++------- .../delivery/DeliveryDeleteCommand.java | 8 +++-- .../delivery/DeliveryEditCommand.java | 29 ++++++++++--------- .../delivery/DeliveryViewCommand.java | 2 +- .../address/logic/parser/ParserUtil.java | 2 +- 6 files changed, 42 insertions(+), 37 deletions(-) diff --git a/src/main/java/seedu/address/logic/commands/customer/CustomerDeleteCommand.java b/src/main/java/seedu/address/logic/commands/customer/CustomerDeleteCommand.java index 6c0f22f61a8..300d9f06899 100644 --- a/src/main/java/seedu/address/logic/commands/customer/CustomerDeleteCommand.java +++ b/src/main/java/seedu/address/logic/commands/customer/CustomerDeleteCommand.java @@ -29,9 +29,9 @@ public class CustomerDeleteCommand extends CustomerCommand { * The message usage of the delete customer command. */ public static final String MESSAGE_USAGE = COMMAND_WORD - + ": Deletes the customer identified by the customer ID used in the displayed customer list.\n\n" - + "Parameters: CUSTOMER_ID (must be a positive integer)\n\n" - + "Example: " + COMMAND_WORD + " 1"; + + ": Deletes the customer identified by the customer ID used in the displayed customer list.\n\n" + + "Parameters: CUSTOMER_ID (must be a positive integer and less than 2147483648)\n\n" + + "Example: " + COMMAND_WORD + " 1"; /** * The pre-text to the message displayed when the customer is deleted successfully. @@ -69,7 +69,7 @@ public CommandResult execute(Model model) throws CommandException { requireNonNull(model); logger.info("Executing CustomerDeleteCommand:" - + " customerID: " + customerID.getOneBased() + "\n"); + + " customerID: " + customerID.getOneBased() + "\n"); // User cannot perform this operation before logging in if (!model.getUserLoginStatus()) { @@ -90,7 +90,7 @@ public CommandResult execute(Model model) throws CommandException { model.deleteCustomer(customerToDelete.get()); return new CommandResult(String.format(MESSAGE_DELETE_CUSTOMER_SUCCESS, - Messages.format(customerToDelete.get())), true); + Messages.format(customerToDelete.get())), true); } /** @@ -122,7 +122,7 @@ public boolean equals(Object other) { @Override public String toString() { return new ToStringBuilder(this) - .add("customerID", customerID) - .toString(); + .add("customerID", customerID) + .toString(); } } diff --git a/src/main/java/seedu/address/logic/commands/customer/CustomerEditCommand.java b/src/main/java/seedu/address/logic/commands/customer/CustomerEditCommand.java index 323da048050..42187332067 100644 --- a/src/main/java/seedu/address/logic/commands/customer/CustomerEditCommand.java +++ b/src/main/java/seedu/address/logic/commands/customer/CustomerEditCommand.java @@ -42,19 +42,19 @@ public class CustomerEditCommand extends CustomerCommand { public static final String COMMAND_WORD = CustomerCommand.COMMAND_WORD + " " + "edit"; /** - * The text displayed to show what the command does and how to use it. + * The text displayed to show what the command does and how to use it. */ public static final String MESSAGE_USAGE = COMMAND_WORD + ": Edits the details of the person identified " - + "by the customer ID used in the displayed person list. " - + "Existing values will be overwritten by the input values.\n\n" - + "Parameters: CUSTOMER_ID (must be a positive integer) " - + "[" + PREFIX_NAME + " NAME] " - + "[" + PREFIX_PHONE + " PHONE] " - + "[" + PREFIX_EMAIL + " EMAIL] " - + "[" + PREFIX_ADDRESS + " ADDRESS]\n\n" - + "Example: " + COMMAND_WORD + " 1 " - + PREFIX_PHONE + " 91234567 " - + PREFIX_EMAIL + " johndoe@example.com"; + + "by the customer ID used in the displayed person list. " + + "Existing values will be overwritten by the input values.\n\n" + + "Parameters: CUSTOMER_ID (must be a positive integer and less than 2147483648) " + + "[" + PREFIX_NAME + " NAME] " + + "[" + PREFIX_PHONE + " PHONE] " + + "[" + PREFIX_EMAIL + " EMAIL] " + + "[" + PREFIX_ADDRESS + " ADDRESS]\n\n" + + "Example: " + COMMAND_WORD + " 1 " + + PREFIX_PHONE + " 91234567 " + + PREFIX_EMAIL + " johndoe@example.com"; /** * The text to the message displayed when the Customer is edited successfuly. @@ -73,6 +73,7 @@ public class CustomerEditCommand extends CustomerCommand { /** * Creates a CustomerEditCommand to edit the customers. + * * @param targetIndex of the person in the filtered person list to edit * @param customerEditDescriptor details to edit the person with */ @@ -86,6 +87,7 @@ public CustomerEditCommand(Index targetIndex, CustomerEditDescriptor customerEdi /** * Executes the CustomerEditCommand. + * * @param model {@code Model} which the command should operate on. * @return The command result along with the message to be displayed to the user. * @throws CommandException If the user is not logged in or if the customer does not exist or if the edited diff --git a/src/main/java/seedu/address/logic/commands/delivery/DeliveryDeleteCommand.java b/src/main/java/seedu/address/logic/commands/delivery/DeliveryDeleteCommand.java index 71130837673..3e2380559ba 100644 --- a/src/main/java/seedu/address/logic/commands/delivery/DeliveryDeleteCommand.java +++ b/src/main/java/seedu/address/logic/commands/delivery/DeliveryDeleteCommand.java @@ -26,9 +26,9 @@ public class DeliveryDeleteCommand extends DeliveryCommand { public static final String COMMAND_WORD = DeliveryCommand.COMMAND_WORD + " " + "delete"; public static final String MESSAGE_USAGE = COMMAND_WORD - + ": Deletes the delivery identified by the delivery ID used in the displayed delivery list.\n\n" - + "Parameters: DELIVERY_ID (must be a positive integer)\n\n" - + "Example: " + COMMAND_WORD + " 1"; + + ": Deletes the delivery identified by the delivery ID used in the displayed delivery list.\n\n" + + "Parameters: DELIVERY_ID (must be a positive integer and less than 2147483648)\n\n" + + "Example: " + COMMAND_WORD + " 1"; /** * The text to the message displayed when the Delivery is delete successfuly. @@ -44,6 +44,7 @@ public class DeliveryDeleteCommand extends DeliveryCommand { /** * Creates a DeliveryDeleteCommand to delete the specified {@code Delivery} + * * @param targetIndex */ public DeliveryDeleteCommand(Index targetIndex) { @@ -52,6 +53,7 @@ public DeliveryDeleteCommand(Index targetIndex) { /** * Executes the DeliveryDeleteCommand. + * * @param model {@code Model} which the command should operate on. * @return The command result along with the message to be displayed to the user. * @throws CommandException If the delivery to be deleted does not exist or the user is not logged in. diff --git a/src/main/java/seedu/address/logic/commands/delivery/DeliveryEditCommand.java b/src/main/java/seedu/address/logic/commands/delivery/DeliveryEditCommand.java index 529fc155fd3..72d96f68fb5 100644 --- a/src/main/java/seedu/address/logic/commands/delivery/DeliveryEditCommand.java +++ b/src/main/java/seedu/address/logic/commands/delivery/DeliveryEditCommand.java @@ -44,21 +44,21 @@ public class DeliveryEditCommand extends DeliveryCommand { * The text displayed to show what the command does and how to use it. */ public static final String MESSAGE_USAGE = COMMAND_WORD + ": Edits the details of the delivery identified " - + "by the DELIVERY_ID used in the displayed delivery list. " - + "Existing values will be overwritten by the input values.\n\n" - + "Parameters: DELIVERY_ID (must be a positive integer)\n\n" - + "At least one field must be specified." - + "[" + PREFIX_NAME + " DELIVERY_NAME] " - + "[" + PREFIX_CUSTOMER_ID + " CUSTOMER_ID] " - + "[" + PREFIX_DATE + " DELIVERY_DATE] " - + "[" + PREFIX_STATUS + " STATUS] " - + "[" + PREFIX_NOTE + " NOTE]...\n\n" - + "Example: " + COMMAND_WORD + " 1 " - + PREFIX_NAME + " 10 Chocolate Cakes " - + PREFIX_DATE + " 2025-12-12"; + + "by the DELIVERY_ID used in the displayed delivery list. " + + "Existing values will be overwritten by the input values.\n\n" + + "Parameters: DELIVERY_ID (must be a positive integer and less than 2147483648)\n\n" + + "At least one field must be specified." + + "[" + PREFIX_NAME + " DELIVERY_NAME] " + + "[" + PREFIX_CUSTOMER_ID + " CUSTOMER_ID] " + + "[" + PREFIX_DATE + " DELIVERY_DATE] " + + "[" + PREFIX_STATUS + " STATUS] " + + "[" + PREFIX_NOTE + " NOTE]...\n\n" + + "Example: " + COMMAND_WORD + " 1 " + + PREFIX_NAME + " 10 Chocolate Cakes " + + PREFIX_DATE + " 2025-12-12"; /** - * The text to the message displayed when the Delivery is edited successfuly. + * The text to the message displayed when the Delivery is edited successfuly. */ public static final String MESSAGE_EDIT_DELIVERY_SUCCESS = "Edited Delivery:\n\n%1$s"; public static final String MESSAGE_NOT_EDITED = "At least one field must be provided!"; @@ -70,6 +70,7 @@ public class DeliveryEditCommand extends DeliveryCommand { /** * Creates a DeliveryEditCommand to edit the specified {@code Delivery} + * * @param targetIndex of the delivery in the delivery list to edit * @param deliveryEditDescriptor details to edit the delivery with */ @@ -115,7 +116,7 @@ public CommandResult execute(Model model) throws CommandException { model.showAllFilteredDeliveryList(); return new CommandResult(String.format(MESSAGE_EDIT_DELIVERY_SUCCESS, - Messages.format(editedDelivery)), true); + Messages.format(editedDelivery)), true); } diff --git a/src/main/java/seedu/address/logic/commands/delivery/DeliveryViewCommand.java b/src/main/java/seedu/address/logic/commands/delivery/DeliveryViewCommand.java index e952977ab2c..a597f26ec86 100644 --- a/src/main/java/seedu/address/logic/commands/delivery/DeliveryViewCommand.java +++ b/src/main/java/seedu/address/logic/commands/delivery/DeliveryViewCommand.java @@ -20,7 +20,7 @@ public class DeliveryViewCommand extends DeliveryCommand { public static final String COMMAND_WORD = DeliveryCommand.COMMAND_WORD + " view"; public static final String MESSAGE_USAGE = COMMAND_WORD + ": Displays a single delivery order.\n\n" + "Parameters: " - + "DELIVERY_ID (Must be a positive integer)\n\n" + + "DELIVERY_ID (Must be a positive integer and less than 2147483648)\n\n" + "Example: " + COMMAND_WORD + " " + "1"; diff --git a/src/main/java/seedu/address/logic/parser/ParserUtil.java b/src/main/java/seedu/address/logic/parser/ParserUtil.java index cf9b2f2ef73..6ab0f5fc1e8 100644 --- a/src/main/java/seedu/address/logic/parser/ParserUtil.java +++ b/src/main/java/seedu/address/logic/parser/ParserUtil.java @@ -26,7 +26,7 @@ */ public class ParserUtil { - public static final String MESSAGE_INVALID_INDEX = "ID must be an integer more than 0."; + public static final String MESSAGE_INVALID_INDEX = "ID must be an integer more than 0 and less than 2147483648."; /** From 8cbf9065206df1f09f3235ba53eddc922d88a247 Mon Sep 17 00:00:00 2001 From: zhonghan721 Date: Mon, 13 Nov 2023 13:20:12 +0800 Subject: [PATCH 16/17] Update command and size of diagrams --- docs/DeveloperGuide.md | 42 +++++++++--------- docs/diagrams/DeleteSequenceDiagram.puml | 56 ++++++++++++------------ 2 files changed, 49 insertions(+), 49 deletions(-) diff --git a/docs/DeveloperGuide.md b/docs/DeveloperGuide.md index 7ecacbff818..3802f5af39a 100644 --- a/docs/DeveloperGuide.md +++ b/docs/DeveloperGuide.md @@ -133,9 +133,9 @@ PlantUML, the lifeline reaches the end of diagram. How the `Logic` component works: 1. When `Logic` is called upon to execute a command, it is passed to an `AddressBookParser` object which in turn creates - a parser that matches the command (e.g., `DeleteCommandParser`) and uses it to parse the command. -1. This results in a `Command` object (more precisely, an object of one of its subclasses e.g., `DeleteCommand`) which - is executed by the `LogicManager`. + a parser that matches the command (e.g., `CustomerDeleteCommandParser`) and uses it to parse the command. +1. This results in a `Command` object (more precisely, an object of one of its subclasses e.g., `CustomerDeleteCommand`) + which is executed by the `LogicManager`. 1. The command can communicate with the `Model` when it is executed (e.g. to delete a customer). 1. The result of the command execution is encapsulated as a `CommandResult` object which is returned back from `Logic`. @@ -146,11 +146,11 @@ Here are the other classes in `Logic` (omitted from the class diagram above) tha How the parsing works: - When called upon to parse a user command, the `AddressBookParser` class creates an `XYZCommandParser` (`XYZ` is a - placeholder for the specific command name e.g., `AddCommandParser`) which uses the other classes shown above to parse - the user command and create a `XYZCommand` object (e.g., `AddCommand`) which the `AddressBookParser` returns back as - a `Command` object. -- All `XYZCommandParser` classes (e.g., `AddCommandParser`, `DeleteCommandParser`, ...) inherit from the `Parser` - interface so that they can be treated similarly where possible e.g, during testing. + placeholder for the specific command name e.g., `CustomerAddCommandParser`) which uses the other classes shown above + to parse the user command and create a `XYZCommand` object (e.g., `CustomerAddCommand`) which the `AddressBookParser` + returns back as a `Command` object. +- All `XYZCommandParser` classes (e.g., `CustomerAddCommandParser`, `DeliveryDeleteCommandParser`, ...) inherit from + the `Parser` interface so that they can be treated similarly where possible e.g, during testing. ### Model component @@ -158,13 +158,13 @@ How the parsing works: [`Model.java`](https://github.com/AY2324S1-CS2103T-T13-3/tp/tree/master/src/main/java/seedu/address/model/Model.java) - + The `Model` component, -* stores the address book data i.e., all `Customer` objects. (See the [ReadOnlyBook Model](#ReadOnlyBook-Model) section +* stores the address book data i.e., all `Customer` objects. (See the [ReadOnlyBook Model](#readonlybook-model) section below for more details) -* stores the delivery book data i.e., all `Delivery` objects. (See the [ReadOnlyBook Model](#ReadOnlyBook-Model) section +* stores the delivery book data i.e., all `Delivery` objects. (See the [ReadOnlyBook Model](#readonlybook-model) section below for more details) * stores the currently filtered `Customer` objects (See the [Customer Model](#customer-model)) as a separate _filteredCustomers_ list. (e.g., results of a `customer list` command) @@ -185,7 +185,7 @@ The `Model` component, The `ReadOnlyBook` model, - + * exposes the `AddressBook` and `DeliveryBook` to the outside. * The `AddressBook` class stores the address book data i.e., all `Customer` that are contained through @@ -195,7 +195,7 @@ The `ReadOnlyBook` model, #### User Model - + The `User` model, @@ -203,7 +203,7 @@ The `User` model, #### Delivery Model - + The `Delivery` model, @@ -212,7 +212,7 @@ The `Delivery` model, #### Customer Model - + The `Customer` model, @@ -302,7 +302,7 @@ The sequence of the `delivery status` command is as follows: The following sequence diagram illustrates the `delivery status` command sequence: - + This section describes some noteworthy details on how certain features are implemented. @@ -367,7 +367,7 @@ command executes successfully The following diagram illustrates the `delivery note` command sequence: - + ### User Register Account Command @@ -448,7 +448,7 @@ The format of the `delivery list` command can be found The following activity diagram illustrates the logic for listing `Delivery`. Some ParseExceptions are omitted for better readability. - + The sequence of the `delivery list` command is as follows: @@ -508,7 +508,7 @@ The format of the `delivery view` command can be found The following activity diagram illustrates the logic of viewing a `Delivery`. - + The sequence of the `delivery view` command is as follows: @@ -527,7 +527,7 @@ The sequence of the `delivery view` command is as follows: The following sequence diagram illustrates the `delivery view` command sequence: - + ### User Login Command @@ -603,7 +603,7 @@ The sequence of the `logout` command is as follows: The following sequence diagram shows how the `login` command works: - + ### Add Customer Command diff --git a/docs/diagrams/DeleteSequenceDiagram.puml b/docs/diagrams/DeleteSequenceDiagram.puml index 40ea6c9dc4c..df7f9b04b22 100644 --- a/docs/diagrams/DeleteSequenceDiagram.puml +++ b/docs/diagrams/DeleteSequenceDiagram.puml @@ -5,8 +5,8 @@ skinparam ArrowFontStyle plain box Logic LOGIC_COLOR_T1 participant ":LogicManager" as LogicManager LOGIC_COLOR participant ":AddressBookParser" as AddressBookParser LOGIC_COLOR -participant ":DeleteCommandParser" as DeleteCommandParser LOGIC_COLOR -participant "d:DeleteCommand" as DeleteCommand LOGIC_COLOR +participant ":CustomerDeleteCommandParser" as CustomerDeleteCommandParser LOGIC_COLOR +participant "d:CustomerDeleteCommand" as CustomerDeleteCommand LOGIC_COLOR participant ":CommandResult" as CommandResult LOGIC_COLOR end box @@ -14,56 +14,56 @@ box Model MODEL_COLOR_T1 participant ":Model" as Model MODEL_COLOR end box -[-> LogicManager : execute("delete 1") +[-> LogicManager : execute("customer delete 1") activate LogicManager -LogicManager -> AddressBookParser : parseCommand("delete 1") +LogicManager -> AddressBookParser : parseCommand("customer delete 1") activate AddressBookParser -create DeleteCommandParser -AddressBookParser -> DeleteCommandParser -activate DeleteCommandParser +create CustomerDeleteCommandParser +AddressBookParser -> CustomerDeleteCommandParser +activate CustomerDeleteCommandParser -DeleteCommandParser --> AddressBookParser -deactivate DeleteCommandParser +CustomerDeleteCommandParser --> AddressBookParser +deactivate CustomerDeleteCommandParser -AddressBookParser -> DeleteCommandParser : parse("1") -activate DeleteCommandParser +AddressBookParser -> CustomerDeleteCommandParser : parse("1") +activate CustomerDeleteCommandParser -create DeleteCommand -DeleteCommandParser -> DeleteCommand -activate DeleteCommand +create CustomerDeleteCommand +CustomerDeleteCommandParser -> CustomerDeleteCommand +activate CustomerDeleteCommand -DeleteCommand --> DeleteCommandParser : d -deactivate DeleteCommand +CustomerDeleteCommand --> CustomerDeleteCommandParser : d +deactivate CustomerDeleteCommand -DeleteCommandParser --> AddressBookParser : d -deactivate DeleteCommandParser +CustomerDeleteCommandParser --> AddressBookParser : d +deactivate CustomerDeleteCommandParser 'Hidden arrow to position the destroy marker below the end of the activation bar. -DeleteCommandParser -[hidden]-> AddressBookParser -destroy DeleteCommandParser +CustomerDeleteCommandParser -[hidden]-> AddressBookParser +destroy CustomerDeleteCommandParser AddressBookParser --> LogicManager : d deactivate AddressBookParser -LogicManager -> DeleteCommand : execute() -activate DeleteCommand +LogicManager -> CustomerDeleteCommand : execute() +activate CustomerDeleteCommand -DeleteCommand -> Model : deletePerson(1) +CustomerDeleteCommand -> Model : deleteCustomer(1) activate Model -Model --> DeleteCommand +Model --> CustomerDeleteCommand deactivate Model create CommandResult -DeleteCommand -> CommandResult +CustomerDeleteCommand -> CommandResult activate CommandResult -CommandResult --> DeleteCommand +CommandResult --> CustomerDeleteCommand deactivate CommandResult -DeleteCommand --> LogicManager : result -deactivate DeleteCommand +CustomerDeleteCommand --> LogicManager : result +deactivate CustomerDeleteCommand [<--LogicManager deactivate LogicManager From 8a0a6681818a56da139276c240027921ff898457 Mon Sep 17 00:00:00 2001 From: zhonghan721 Date: Mon, 13 Nov 2023 15:00:40 +0800 Subject: [PATCH 17/17] Add whitespace --- docs/DeveloperGuide.md | 115 ++++++++++++++++++++++++++++++++++------- 1 file changed, 95 insertions(+), 20 deletions(-) diff --git a/docs/DeveloperGuide.md b/docs/DeveloperGuide.md index 3802f5af39a..c4d8c73b71c 100644 --- a/docs/DeveloperGuide.md +++ b/docs/DeveloperGuide.md @@ -82,6 +82,8 @@ implementation of a component), as illustrated in the (partial) class diagram be The sections below give more details of each component. +
+ ### UI component The **API** of this component is specified @@ -110,6 +112,8 @@ The `UI` component, and `Delivery` objects residing in the `Model`. +
+ ### Logic component **API** : @@ -152,6 +156,8 @@ How the parsing works: - All `XYZCommandParser` classes (e.g., `CustomerAddCommandParser`, `DeliveryDeleteCommandParser`, ...) inherit from the `Parser` interface so that they can be treated similarly where possible e.g, during testing. +
+ ### Model component **API** : @@ -181,18 +187,23 @@ The `Model` component, * does not depend on any of the other three components (as the `Model` represents data entities of the domain, they should make sense on their own without depending on other components) -#### ReadOnlyBook Model -The `ReadOnlyBook` model, +
+ +#### ReadOnlyBook Model +The `ReadOnlyBook` model, + * exposes the `AddressBook` and `DeliveryBook` to the outside. * The `AddressBook` class stores the address book data i.e., all `Customer` that are contained through the `UniqueCustomerList`. * The `DeliveryBook` class stores the delivery book data i.e., all `Delivery` that are contained through the `UniqueDeliveryList`. +
+ #### User Model @@ -201,6 +212,8 @@ The `User` model, * stores the user data i.e, the username, password, secret question and secret answer of the user. +
+ #### Delivery Model @@ -210,6 +223,8 @@ The `Delivery` model, * stores the delivery data i.e, the delivery ID, delivery name, customer, delivery status, order date, expected delivery date and note for the delivery. +
+ #### Customer Model @@ -218,6 +233,8 @@ The `Customer` model, * stores the customer data i.e, the customer ID, customer address, phone, email and address. +
+ ### Storage component **API** : @@ -237,6 +254,8 @@ The concrete implementation of storage is done through `StorageManger`, which ho `BookStorage` and `BookStorageWithReference`. Which represents the User Preference Data, Address Book and Delivery Book respectively. +
+ ### Common classes Classes used by multiple components are in the `seedu.addressbook.commons` package. @@ -250,12 +269,15 @@ This section describes some noteworthy details on how certain features are imple - [Update Delivery Status](#update-delivery-status-feature) - [Create Delivery Note](#create-note-for-delivery-feature) - [User Register Account Command](#user-register-account-command) +- [Delivery List Command](#list-delivery-feature) +- [Deliver View Command](#view-delivery-feature) - [User Login](#user-login-command) -- User Update Details - [User Logout](#user-logout-command) -- User Account Recovery -- User Account Deletion - [Add Customer](#add-customer-command) +- [Customer Edit Command](#customer-edit-command) +- [Delivery Add Command](#delivery-add-command) + +
### Update Delivery Status Feature @@ -304,19 +326,7 @@ The following sequence diagram illustrates the `delivery status` command sequenc -This section describes some noteworthy details on how certain features are implemented. - -- [Create Delivery Note](#create-note-for-delivery-feature) -- [User Register Account Command](#user-register-account-command) -- [Delivery List Command](#list-delivery-feature) -- [Deliver View Command](#view-delivery-feature) -- [User Login Command](#user-login-command) -- User Update Details Command -- [User Logout Command](#user-logout-command) -- User Account Recovery -- User Account Deletion -- Customer Edit Command -- Delivery Add Command +
### Create Note for Delivery Feature @@ -369,6 +379,8 @@ The following diagram illustrates the `delivery note` command sequence: +
+ ### User Register Account Command **Overview:** @@ -414,6 +426,8 @@ The following sequence diagram shows how the `register` command works: +
+ ### List Delivery Feature ### Overview @@ -483,6 +497,8 @@ The following sequence diagram illustrates the `delivery list` command sequence: +
+ ### View Delivery Feature #### Overview @@ -529,6 +545,8 @@ The following sequence diagram illustrates the `delivery view` command sequence: +
+ ### User Login Command **Overview:** @@ -570,6 +588,8 @@ The following sequence diagram shows how the `login` command works: +
+ ### User Logout Command **Overview:** @@ -605,6 +625,8 @@ The following sequence diagram shows how the `login` command works: +
+ ### Add Customer Command **Overview:** @@ -647,6 +669,8 @@ The following sequence diagram shows how the `login` command works: +
+ ### Customer Edit Command **Overview:** @@ -695,6 +719,8 @@ The following sequence diagram shows how the `customer edit` command works: +
+ ### Delivery Add Command **Overview:** @@ -742,6 +768,8 @@ The following sequence diagram shows how the `delivery add` command works: +
+ ### \[Proposed\] Undo/redo feature #### Proposed Implementation @@ -1936,7 +1964,7 @@ otherwise) 1. Perform Inventory Management 2. Perform Route Planning -_{More to be added}_ +
### Glossary @@ -1958,7 +1986,7 @@ _{More to be added}_ Given below are instructions to test the app manually. - + **Note:** These instructions only provide a starting point for testers to work on; testers are expected to do more _exploratory_ testing. @@ -1995,6 +2023,8 @@ testers are expected to do more _exploratory_ testing. 2. Using the `login`{.swift} command, log in into HomeBoss with the same user details entered earlier. Expected: User is able to log in successfully and see the HomeBoss homepage. +
+ ### Register 1. Registering for an account. @@ -2025,6 +2055,8 @@ testers are expected to do more _exploratory_ testing. Expected: No new user is registered. Error indicating existing account is shown in the feedback message. +
+ ### Login 1. Login to an account. @@ -2054,6 +2086,7 @@ testers are expected to do more _exploratory_ testing. Expected: The user does not get logged-in. Error indicating invalid command format is shown in the feedback message. +
### Update Account Details @@ -2095,6 +2128,8 @@ testers are expected to do more _exploratory_ testing. Expected: No user details are updated. Error indicating that secret question and answer must be both present or both absent is shown in the feedback message. +
+ ### Logout 1. Logging out of the application. @@ -2108,6 +2143,8 @@ testers are expected to do more _exploratory_ testing. 3. Test Case: `logout extra`{.swift} or other extra arguments.
Expected: Similar to previous. +
+ ### Recover Account 1. Recovering user account. @@ -2136,6 +2173,8 @@ testers are expected to do more _exploratory_ testing. Expected: No user details are updated. Error indicating invalid command format is shown in the feedback message. +
+ ### Delete Account 1. Delete currently stored user account. @@ -2148,6 +2187,8 @@ testers are expected to do more _exploratory_ testing. 3. Test Case: `delete account extra`{.swift} or other extra arguments.
Expected: Similar to previous. +
+ ### Add Customer 1. Adding a Customer to the application. @@ -2184,6 +2225,8 @@ testers are expected to do more _exploratory_ testing. Expected: No new Customer is added. Error indicating invalid command format is shown in the feedback message. +
+ ### View Details of Customer 1. View the details of a Customer. @@ -2209,6 +2252,8 @@ testers are expected to do more _exploratory_ testing. Expected: No new Customer details are shown. Error indicating invalid customer ID is shown in the feedback message. +
+ ### List Customers 1. List the Customers stored in the application. @@ -2223,6 +2268,8 @@ testers are expected to do more _exploratory_ testing. 3. Test Case: `customer list extra`{.swift}.
Expected: Similar to previous. +
+ ### Find Customers 1. Find a Customers matching query. @@ -2249,6 +2296,8 @@ testers are expected to do more _exploratory_ testing. Expected: No customers are shown. A message indicating the number of Customers listed is shown in the result message. +
+ ### Update Customer Details 1. Update the details of a specific Customer. @@ -2284,6 +2333,8 @@ testers are expected to do more _exploratory_ testing. Expected: No Customer details are updated. An error indicating invalid command format is shown in the feedback message. +
+ ### Delete Customers 1. Delete a specified Customer. @@ -2309,6 +2360,8 @@ testers are expected to do more _exploratory_ testing. Expected: No Customer is deleted. Error indicating invalid Customer ID is shown in the feedback message. +
+ ### Add Delivery 1. Adding a Delivery to the application. @@ -2349,6 +2402,8 @@ testers are expected to do more _exploratory_ testing. Expected: No new Delivery is added. An Error indicating invalid command format is shown in the feedback message. +
+ ### View Details of a Delivery 1. View the details of a Delivery. @@ -2374,6 +2429,8 @@ testers are expected to do more _exploratory_ testing. Expected: No new Delivery details are shown. Error indicating invalid delivery ID is shown in the feedback message. +
+ ### List Deliveries 1. List the Deliveries stored in the application. @@ -2428,6 +2485,8 @@ testers are expected to do more _exploratory_ testing. Expected: No Deliveries are listed. An Error indicating sort constraints is shown in the feedback message. +
+ ### Find Deliveries 1. Find Deliveries matching query. @@ -2455,6 +2514,8 @@ testers are expected to do more _exploratory_ testing. Expected: No Deliveries are shown. A message indicating the number of Deliveries listed is shown in the result message. +
+ ### Update details of a Delivery 1. Update the details of a specific Delivery. @@ -2525,6 +2586,8 @@ testers are expected to do more _exploratory_ testing. Expected: No Delivery details are updated. An error indicating invalid command format is shown in the feedback message. +
+ ### Update delivery status 1. Update the status of a specific Delivery. @@ -2553,6 +2616,8 @@ testers are expected to do more _exploratory_ testing. Expected: No delivery statuses are updated. An error indicating invalid command format is shown in the feedback message. +
+ ### Create a note for a Delivery 1. Create a note for a specific delivery. @@ -2583,6 +2648,8 @@ testers are expected to do more _exploratory_ testing. Expected: No delivery notes are updated. An error indicating invalid delivery ID is shown in the feedback message. +
+ ### Delete Delivery 1. Delete a specific delivery. @@ -2609,6 +2676,8 @@ testers are expected to do more _exploratory_ testing. Expected: No Delivery is deleted. An Error indicating invalid Delivery ID is shown in the feedback message. +
+ ### Help 1. Shows the help information to the user. @@ -2621,6 +2690,8 @@ testers are expected to do more _exploratory_ testing. 3. Test Case: `help extra`{.swift}.
Expected: Similar to previous. +
+ ### Exit 1. Exits the application. @@ -2633,6 +2704,8 @@ testers are expected to do more _exploratory_ testing. 3. Test Case: `exit extra`{.swift}.
Expected: Similar to previous. +
+ ### Clear 1. Clears all Customer and Delivery data. @@ -2646,6 +2719,8 @@ testers are expected to do more _exploratory_ testing. 3. Test Case: `clear extra`{.swift}.
Expected: Similar to previous. +
+ ### Saving data 1. Dealing with missing/corrupted data files.