Skip to content

Commit

Permalink
Merge pull request #178 from IanFH/docs2
Browse files Browse the repository at this point in the history
Created Sequence Diagram for `recommendCommand` and `askOccasion()`. …
  • Loading branch information
samuelory committed Apr 15, 2024
2 parents 1b305d2 + b4b288b commit 6d59605
Show file tree
Hide file tree
Showing 9 changed files with 242 additions and 48 deletions.
67 changes: 49 additions & 18 deletions docs/DeveloperGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,41 @@ Step 3: `InfoCommand` class will call `printFlowerInfo()` method of `Ui` class

Step 4: `get()` of `FlowerDictionary` class will then be called in order to retrive information about the specified flower. This information will be printed by the `Ui` class

### Flower Remove Command
### Flower Help Command

`help` Shows a list of valid commands

![Help Command Sequence Diagram](UML-diagrams/Jeffinson/Jeffinson-UML-Help.png);

Help command utilises the `parser` class to identify the keyword `help`

**Step 1:** User will write `help` and `HelpCommand` class will be instantiated and `execute()` method will run.

**Step 2:** `HelpCommand` class will call `printHelpMessage()` method of `Ui` class

**Step 3:** The list of valid commands will be printed by the `Ui` class

### Add Flower Command

`add <flower> /q <quantity> /to <targetBouquet>` command adds specified number of flower to a bouquet

![Add Flower Command Diagram](UML-diagrams/Ijaaz/Ijaaz-UML.png)

**Step 1:** Firstly the input is put into the `Parser.parse()` method to identify that it is infact an add flower command.

**Step 2:** Then an object of type `AddFlowerCommand` is returned which contains the name, quantity of the flower to be added, as well as the target bouquet

**Step 3:** The `execute()` method is called to execute the add flower command

**Step 4:** The target bouquet, which is under model, is updated accordingly

**Step 5:** A confirmation message is then sent back to the user

### Remove Flower Command

`remove <flowerName> /q <quantity> /from <bouquetName>` removes flower(s) from a bouquet

![Remove Command Sequence Diagram](UML-diagrams/Jeffinson/Jeffinson-UML-Remove.png);
![Remove Command Sequence Diagram](UML-diagrams/Jeffinson/Jeffinson-UML-Remove.png)

Removing flowers utilise the `parser` class to parse user command to identify which flower to remove,
how much to remove and from which bouquet to remove.
Expand All @@ -67,35 +97,36 @@ class will be instantiated and run its `execute()` method.

**Step 4:** The flowers are removed and a confirmation message is sent back to the user

### Flower Help Command
### Recommend Command

`help` Shows a list of valid commands
`recommend` recommends a bouquet based on user input

![Help Command Sequence Diagram](UML-diagrams/Jeffinson/Jeffinson-UML-Help.png);
![Recommend Command Sequence Diagram](UML-diagrams/Ian/RecommendCommand.png)
*simplified version of the sequence diagram*

Help command utilises the `parser` class to identify the keyword `help`
**Step 1:** User will input `recommend` into the CLI, which will be parsed by the `parser` class to identify.

**Step 1: ** User will write `help` and `HelpCommand` class will be instantiated and `execute()` method will run.
**Step 2:** `RecommendCommand` class will be instantiated and run its `execute()` method.

**Step 2:** `HelpCommand` class will call `printHelpMessage()` method of `Ui` class
**Step 3:** Various methods will be called to get the user input. In order, the methods are `askOccasion(...)`, `askColour(...)`, `askSize(...)`, `askBouquetName(...)`, `askSize()`, `addRandomFlowers()`, `askSaveBouquet()`.

**Step 3:** The list of valid commands will be printed by the `Ui` class
#### askOccasion(...)

### Add Flower Command
A deeper look into the `askOccasion(...)` method

`add <flower> /q <quantity> /to <targetBouquet>` command adds specified number of flower to a bouquet
![askOccasion Sequence Diagram](UML-diagrams/Ian/askOccasion.png)

![Add Flower Command Diagram](UML-diagrams/Ijaaz/Ijaaz-UML.png)
**Step 1:** `askOccasion(...)` method will call `Ui.askOccasion()` to get the user input.

Step 1: Firstly the input is put into the `Parser.parse()` method to identify that it is infact an add flower command.
**Step 2:** `askOccasion(...)` method will call `Parser` to validate the format of user input.

Step 2: Then an object of type `AddFlowerCommand` is returned which contains the name, quantity of the flower to be added, as well as the target bouquet
**Step 3:** `askOccasion(...)` method will check with `Flower` class to see if the occasion is valid.

Step 3: The `execute()` method is called to execute the add flower command
**Step 4:** once format is validated and the occasion inputted is valid, the method will return the occasion.

Step 4: The target bouquet, which is under model, is updated accordingly
#### askColour(...), askSize(...), askBouquetName(...), askSize(...), addRandomFlowers(...), askSaveBouquet()

Step 5: A confirmation message is then sent back to the user
The other methods will follow a similar structure as `askOccasion(...)` method, where the user input is taken, validated, and then stored in the `RecommendCommand` class to be further processed.

### [Proposed] Storage

Expand Down Expand Up @@ -170,7 +201,7 @@ Main Success Scenario (MSS):
4. Programme responds that the 3 stalks of rose has been successfully added
5. Programme displays the current state of "for valentine" bouquet and all the flowers inside it

** Use case: Removing flowers from a bouquet named "for valentine" **
**Use case: Removing flowers from a bouquet named "for valentine"**

Main Success Scenario (MSS):
1. User removes 5 stalks of rose from the bouquet named "for valentine"
Expand Down
Binary file added docs/UML-diagrams/Ian/RecommendCommand.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/UML-diagrams/Ian/askOccasion.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
33 changes: 33 additions & 0 deletions docs/UML-diagrams/Ian/askOccasion.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
@startuml
'https://plantuml.com/sequence-diagram
!include Ian-style.puml

box Logic LOGIC_COLOUR
participant ":Parser" as Parser LOGIC_COLOUR_T1
participant "a:RecommendCommand" as RecommendCommand LOGIC_COLOUR_T1
participant "b:Flower" as Flower LOGIC_COLOUR_T1

box Ui UI_COLOUR
participant ":Ui" as Ui UI_COLOUR_T1

activate RecommendCommand

loop !isValidFormat && !isValidOccasion
RecommendCommand -> Ui : printAskOccasion()

activate Ui
Ui --> RecommendCommand : input
deactivate Ui

RecommendCommand -> Parser : parseOccasion(input)
activate Parser
Parser --> RecommendCommand : isValidFormat
deactivate Parser

RecommendCommand -> Flower : isValidOccasion()
activate Flower
Flower --> RecommendCommand :isValidOccasion
deactivate Flower

end
@enduml
42 changes: 42 additions & 0 deletions docs/UML-diagrams/Ian/command.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
@startuml
'https://plantuml.com/sequence-diagram
!include Ian-style.puml

actor "user" as user
participant ":Florizz" as Florizz
box Logic LOGIC_COLOUR
participant ":Parser" as Parser LOGIC_COLOUR_T1
participant "a:RecommendCommand" as RecommendCommand LOGIC_COLOUR_T1

[-> Florizz : execute("recommend")
activate Florizz

Florizz -> Parser : parse("recommend")
activate Parser

create RecommendCommand
Parser -> RecommendCommand : RecommendCommand("rose")
activate RecommendCommand

RecommendCommand --> Parser : a
deactivate RecommendCommand

Parser --> Florizz : a
deactivate Parser

Florizz -> RecommendCommand : execute()
activate RecommendCommand

RecommendCommand -> RecommendCommand: askOccasion(...)
RecommendCommand -> RecommendCommand: askColour(...)
RecommendCommand -> RecommendCommand: askBouquetName(...)
RecommendCommand -> RecommendCommand: askSize(...);
RecommendCommand -> RecommendCommand: addRandomFlowers(...)
RecommendCommand -> RecommendCommand: askSaveBouquet(...);

RecommendCommand --> Florizz
deactivate RecommendCommand

<--Florizz
deactivate Florizz
@enduml
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/UML-diagrams/Jeffinson/Jeffinson-UML-Remove.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
106 changes: 82 additions & 24 deletions docs/UserGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,30 @@
Florizz is your personal digital florist which helps people in Singapore to curate flowers to create bouquets for all
occasions.

## Features
### Viewing help: `help`
## Table of Contents
<!-- TOC -->
* [User Guide](#user-guide)
* [Table of Contents](#table-of-contents)
* [Features <a name="Features"></a>](#features-a-namefeaturesa)
* [Viewing help: `help` <a name="help"></a>](#viewing-help-help-a-namehelpa)
* [Create a new bouquet: `new`](#create-a-new-bouquet-new)
* [Delete existing bouquet: `delete`](#delete-existing-bouquet-delete)
* [View existing bouquets: `mybouquets`](#view-existing-bouquets-mybouquets)
* [List all available flowers: `flowers`](#list-all-available-flowers-flowers)
* [View detailed info of a flower: `info`](#view-detailed-info-of-a-flower-info)
* [Add flower: `add`](#add-flower-add)
* [Remove flower: `remove`](#remove-flower-remove)
* [List occasions: `occasion`](#list-occasions-occasion)
* [Recommend A Bouquet: `recommend`](#recommend-a-bouquet-recommend)
* [Save a bouquet to device: `save`](#save-a-bouquet-to-device-save)
* [Compare two flowers: `compare`](#compare-two-flowers-compare)
* [Exit programme: `bye`](#exit-programme-bye)
* [Fuzzy Logic](#fuzzy-logic)
* [Autosave](#autosave)
<!-- TOC -->

## Features <a name="Features"></a>
### Viewing help: `help` <a name="help"></a>
Shows a list of commands and its corresponding function

Format: `help`
Expand Down Expand Up @@ -259,50 +281,86 @@ Here are all the occasions associated with the available flowers:
____________________________________________________________
```
### Recommend A Bouquet: `recommend`
Recommends a bouquet based on the occasion and the recipient's preference

Recommends a bouquet based on the occasion and the recipient's preference. Will enter user into 'recommend mode'. Type `cancel` to exit recommend mode.

Steps:
1. Type command: `recommend`

Expected output:
```
For what occasion are you buying flowers for?
Here is the list of our available occasion:
Here are all the occasions associated with the available flowers:
- Funeral
- Wedding
- Valentines
- Mothers day
____________________________________________________________
For what occasion are you buying flowers for?
Here are all the occasions associated with the available flowers:
- Funeral
- Wedding
- Valentines
- Mothers day
____________________________________________________________
Type 'cancel' if you would like to exit the recommendation page
```

2. Type occasion: `Funeral`

Expected output:
```
What colour would you like your bouquets to be?
Here is the list of colours available for the occasion:
- DARK_CRIMSON
- WHITE
Here is the list of colours available for the occasion:
- Dark crimson
- White
____________________________________________________________
Type 'cancel' if you would like to exit the recommendation page
```

3. Select colour of bouquet: `WHITE`

Expected output:

```
Would you like to save this bouquet to your list?
Here is the full list of flowers in Recommended Bouquet:
- 3 x Lily
- 2 x Chrysanthemum
____________________________________________________________
Type 'yes' to save, 'no' to discard
Great we managed to find some flowers for you!
Before we carry on what would you like to call your bouquet?
Note: please take note 'cancel' cannot be used as a bouquet name
____________________________________________________________
Type 'cancel' if you would like to exit the recommendation page
```

4. Type bouquet name: `for grandma`

Expected output:
```
What size would you like your recommended bouquet to be?
1. Small
2. Medium
3. Large
____________________________________________________________
Type 'cancel' if you would like to exit the recommendation page
```

5. Select bouquet size: `Large`

Expected output:
```
Would you like to save this bouquet to your list?
Here is the full list of flowers in for grandma:
- 2 x Pittosporum
- 2 x Freesia
- 1 x Dusty Miller
- 3 x Chrysanthemum
- 1 x Pistacia
- 2 x Lily
____________________________________________________________
Type 'yes' to save, 'no' to discard
Type 'cancel' if you would like to exit the recommendation page
```
4. Confirm whether you want to add the recommended bouquet to your mybouquets list: `yes`
*Note: The flowers in the bouquet are randomly generated and may differ from the example*


6. Confirm whether you want to add the recommended bouquet to your mybouquets list: `yes`

```
Added new bouquet to list:
Recommended Bouquet
____________________________________________________________
Added new bouquet to list:
for grandma
____________________________________________________________
What can I do for you?
```

### Save a bouquet to device: `save`
Expand Down
42 changes: 36 additions & 6 deletions docs/team/ianfh.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@
Florizz is a digital florist replacement that helps users choose appropriate
flowers to put into a bouquet for various occasions.

### Summary of Contributions
* Click [here](https://nus-cs2113-ay2324s2.github.io/tp-dashboard/?search=ianfh&sort=groupTitle&sortWithin=title&timeframe=commit&mergegroup=&groupSelect=groupByRepos&breakdown=true&checkedFileTypes=docs~functional-code~test-code~other&since=2024-02-23&tabOpen=true&tabType=authorship&tabAuthor=IanFH&tabRepo=AY2324S2-CS2113-T11-3%2Ftp%5Bmaster%5D&authorshipIsMergeGroup=false&authorshipFileTypes=docs~functional-code~test-code~other&authorshipIsBinaryFileTypeChecked=false&authorshipIsIgnoredFilesChecked=false) to view my contributions.
## Summary of Contributions
### Code Contributed
Click [here](https://nus-cs2113-ay2324s2.github.io/tp-dashboard/?search=ianfh&sort=groupTitle&sortWithin=title&timeframe=commit&mergegroup=&groupSelect=groupByRepos&breakdown=true&checkedFileTypes=docs~functional-code~test-code~other&since=2024-02-23&tabOpen=true&tabType=authorship&tabAuthor=IanFH&tabRepo=AY2324S2-CS2113-T11-3%2Ftp%5Bmaster%5D&authorshipIsMergeGroup=false&authorshipFileTypes=docs~functional-code~test-code~other&authorshipIsBinaryFileTypeChecked=false&authorshipIsIgnoredFilesChecked=false) to view my contributions.

### Enhancements Implemented
* **New Feature**: Add Flower Command
* Command takes in the format `add <flowerName> /q <quantity> /to <bouquetName>`. This command was necessary to
allow users to create bouquets with flowers of their choosing, and was a key feature of the programme.
Expand All @@ -23,14 +25,42 @@ flowers to put into a bouquet for various occasions.

* **New Feature**: Recommend Command
* Command takes in the format `recommend` which will enter the user into 'recommend mode'. In this mode, the user can
input the occasion, colour and name of the bouquet and the programme will recommend a bouquet based on the occasion.
* This command was necessary to allow beginner users who is not familiar with flowers to get a bouquet recommendation
input the occasion, colour, name, and size of the bouquet and the programme will recommend a bouquet for them.
* The command matches the user requirements with the flowers in `FlowerDictionary` and creates a bouquet containing some main flowers and some filler flowers.
* This command was necessary to allow beginner users who are not familiar with flowers to get a bouquet recommendation
based on the occasion they are looking for.

* **New Feature**: Bye Command
* Command takes in the format `bye` which will exit the programme. This command was necessary to allow users to exit
the programme when they are done using it.

* **Enhancements to Existing Features**
* **Enhancements**: Added Regex for Parsing User Input
* The first to suggest and implemented regex for parsing user input for `add` and `remove` command. This was necessary to ensure that the user input was
correctly parsed and the correct flower, quantity and bouquet name was identified. [proof](https://github.com/nus-cs2113-AY2324S2/tp/commit/34889baaa7a024c6c8f1fef686b7ebe4493d9f44#diff-bb1b61dd1311729e01e01d2e43ccaf1648d0e8a57a97f5eafc82c1add885d247)
correctly parsed and the correct flower, quantity and bouquet name was identified. [proof](https://github.com/nus-cs2113-AY2324S2/tp/commit/34889baaa7a024c6c8f1fef686b7ebe4493d9f44#diff-bb1b61dd1311729e01e01d2e43ccaf1648d0e8a57a97f5eafc82c1add885d247)

* **Enhancements**: Added More Flowers to `FlowerDictionary`
* Researched main flowers and filler flowers that are available in Singapore along with their prices [proof](https://github.com/AY2324S2-CS2113-T11-3/tp/pull/97/files)

* **Unused** : Configured sqlite3 database for storage of flowers and bouquets.
* This was not used in the final product as we found out DBMS was not allowed for this project. [proof](https://github.com/AY2324S2-CS2113-T11-3/tp/pull/92)

### Contributions to the UG
- Added Table of Contents to the UG [proof](https://github.com/AY2324S2-CS2113-T11-3/tp/pull/178/files)
- Added the add flower command to the UG [proof](https://github.com/AY2324S2-CS2113-T11-3/tp/pull/42/files)
- Added the remove flower command to the UG [proof](https://github.com/AY2324S2-CS2113-T11-3/tp/pull/42/files)
- Added the recommend command to the UG [proof](https://github.com/AY2324S2-CS2113-T11-3/tp/pull/178/files)
- Added the bye command to the UG [proof](https://github.com/AY2324S2-CS2113-T11-3/tp/pull/42/files)

### Contributions to the DG
- Responsible for the add flower command sequence diagram and descriptions [proof](https://github.com/AY2324S2-CS2113-T11-3/tp/pull/78/files)
- Responsible for proposed storage implementation for DG draft [proof](https://github.com/AY2324S2-CS2113-T11-3/tp/pull/78/files)
- Responsible for recommend command sequence diagram and descriptions [proof](https://github.com/AY2324S2-CS2113-T11-3/tp/pull/178/files)
- Responsible for askOccasion sequence diagram and description [proof](https://github.com/AY2324S2-CS2113-T11-3/tp/pull/178/files)
- Responsible for Appendix of product scope, value proposition, user stories, and use cases [proof](https://github.com/AY2324S2-CS2113-T11-3/tp/pull/72/files)
- Updated info command, remove flower command sequence diagram based on TA's feedback [proof](https://github.com/AY2324S2-CS2113-T11-3/tp/pull/169/files)

### Contributions to Team-based Tasks
- Helped to set up the issue tracker for the team (i.e. milestones, tagging)

### Review/mentoring Contributions
- Reviewed and provided feedback on PRs by other team members [proof](https://nus-cs2113-ay2324s2.github.io/dashboards/contents/tp-comments.html#19-ian-anto-ianfh-31-comments)

0 comments on commit 6d59605

Please sign in to comment.