Skip to content

Commit

Permalink
Merge d35ceac into 7241b43
Browse files Browse the repository at this point in the history
  • Loading branch information
rongrongrr committed Nov 11, 2019
2 parents 7241b43 + d35ceac commit 631a87f
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 72 deletions.
73 changes: 46 additions & 27 deletions docs/UserGuide.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ Adds a new expenditure to your total spending. Some things to take note:

Format: `addExpense cat/<category> n/<description> amt/<amount> d/<date> [tg/<tag>]`

* `<category name>`: The `category` that the expense falls under to.
* `<category>`: The `category` that the expense falls under to.
* `<description>`: The name of this expense.
* `<amount>`: The amount spent for this expense. It can contain at most 2 decimal points.
* `<date>`: The date of this expense.
Expand Down Expand Up @@ -366,8 +366,8 @@ image::AddIncomeAfter.png[]

Other examples:

* `add cat/Gifts n/Durian amt/200.00 d/2019 09 09 tg/food`
* `add cat/Business n/business Trip To Mars amt/20000.00 d/2019 09 09`
* `addIncome cat/Gifts n/Durian amt/200.00 d/2019 09 09 tg/food`
* `addIncome cat/Business n/business Trip To Mars amt/20000.00 d/2019 09 09`

==== Listing Incomes: `list`

Expand Down Expand Up @@ -423,8 +423,8 @@ image::DeleteIncomeAfter.png[]

Other examples:

* `add cat/Gifts n/Durian amt/200.00 d/2019 09 09 tg/food`
* `add cat/Business n/business Trip To Mars amt/20000.00 d/2019 09 09`
* `deleteIncome 2`
* `deleteIncome 4`

=== Budget
==== Adding Budget : `addBudget`
Expand All @@ -436,17 +436,17 @@ Format: `addBudget cat/<category name> n/<description> amt/<budget amount> d/<st
Note: format for inputting period is <number><d/m/y> where d/m/y stands for days / months / years respectively
e.g. for a period input of 10 days, use 10d

<category name>: The category that this budget belongs to.
* `<category name>`: The category that this budget belongs to.

<description>: The name of this budget.
* `<description>`: The name of this budget.

<budget amount>: The amount set for this budget. It can contain at most 2 decimal points.
* `<budget amount>`: The amount set for this budget. It can contain at most 2 decimal points.

<start date>: The starting date of this budget.
* `<start date>`: The starting date of this budget.

<period>: The time period for which the budget is valid for. It can be in the form of either days, months, or years. Refer to example given in format.
* `<period>`: The time period for which the budget is valid for. It can be in the form of either days, months, or years. Refer to example given in format.

<tag>: Optional tags for this expense. The tag must not have spaces and most only be alphanumeric.
* `<tag>`: Optional tags for this expense. The tag must not have spaces and most only be alphanumeric.

Example Usage:
[start = 1]
Expand Down Expand Up @@ -542,30 +542,33 @@ Other Examples:
// tag::wishlist[]
=== WishList

==== Add Wish : `addWishlist`
==== Add Wish : `addWish`
Adds a new item to your current wishlist

Format: `addWish n/<Description> cat/<Category> amt/<Price> d/<Date>`
Format: `addWish n/<Description> cat/<Category> amt/<Price> d/<Date> [tg/<tag>]`

Examples:

* `add typ/Wish n/deck mala cat/food amt/5.60 d/2019 10 28`
* `add typ/Wish n/deck mala cat/food amt/5.60 d/01/01/2020`
* `addWish n/deck mala cat/food amt/5.60 d/2019 10 28 tg/foodddddddd`
* `addWish n/deck mala cat/food amt/5.60 d/01/01/2020`

==== List Wish : `listWish`
Lists all the wishes on the main panel.

Format: `listWish`

[NOTE]
If you would like to return the panel display to its original state with incomes and expenses, key in the command `list`.

==== Edit Wish : `editWish`
edit the description, date, or tags of your wishes.

Format: `editWishlist <index> [n/<Description>] [cat/<Category>] [amt/<Price>] [d/<Date>] [tag/<Tag>]`
Format: `editWish <index> [n/<Description>] [cat/<Category>] [amt/<Price>] [d/<Date>] [tg/<Tag>]`

Examples:

* `editWishlist 1 n/1 try the chinatown ri ri hong mala!`
* `editWishlist 1 amt/20 tag/mala tag/expensive`
* `editWish 1 n/1 try the chinatown ri ri hong mala!`
* `editWish 1 amt/20 tg/mala tg/expensive`

==== Delete Wish : `deleteWish`
Deletes the item at the stated index from your current wishlist
Expand All @@ -574,7 +577,7 @@ Format: `deleteWish <index>`

Examples:

* `deleteWishlist 3`
* `deleteWish 3`
// end::wishlist[]

=== Loan [coming in v2.0]
Expand Down Expand Up @@ -658,7 +661,7 @@ The statistics by percentage will be rounded to the nearest 1 decimal place so a

Format: `viewPie [p/<RangeOfMonths>]`

* `<RangeOfMonths>`: The dates that you would like to display the statistics by. If you are interested in a range of months, you have to make sure that the *startMonth* and *endMonth* is separated by a comma, `,`.
* `<RangeOfMonths>`: The dates that you would like to display the statistics by. If you are interested in a range of months, you have to make sure that the *startMonth* and *endMonth* is separated by a comma, `,`. If you're only interested in one month, specify the month in the format `yyyy/MM`

Example Usage:
[start = 1]
Expand Down Expand Up @@ -764,6 +767,11 @@ finding `mala food` will show entries with either mala or food or both in their
Finding by `Tag` will show all entries with all the tags in them. For example, finding by `tg/eat tg/entertainment` will show entries with only
both tags. The reason for this is that tags should be more specific that entry Description.

[NOTE]
For `findIncome` and `findExpense`, user is allowed to find only by months, reasoning being that there are a lot of entries hence finding by day narrows down the user's choices.
For `findBudget`, `findWish` and `findAutoExp`, only the specific days are allowed as there are fewer entries available.


Format: `findExpense [cat/<category>] [n/<description>] [amt/<amount>] [d/<date>] [tg/<tag>]`

[start = 1]
Expand All @@ -777,9 +785,9 @@ image::find-2.png[]

Other Examples:

* `findExpense cat/food n/mala`: lists each entry in expenditure and income with title containing keyword “mala” and category of Food.
* `findIncome cat/business d/2019-09-09`: lists each entry in expenditure and income with date of "2019-09-09" and category of business.
* `findWish d/2019-09-09 tg/a tg/b`: lists each entry in expenditure and income with date of "2019-09-09" and tags of a and b.
* `findExpense cat/food n/mala`: lists each entry in expenditure with title containing keyword “mala” and category of Food.
* `findIncome cat/business d/2019-09`: lists each entry in income with month of "2019-09" and category of business.
* `findWish d/2019-09-09 tg/a tg/b`: lists each entry in wishlist with date of "2019-09-09" and tags of a and b.

// tag::reminders[]
=== Reminders
Expand Down Expand Up @@ -858,16 +866,21 @@ Deletes the selected Reminder.

Format: `deleteReminder`
// end::reminders[]

=== Undo/Redo
==== Undo previous command : `undo`
Restores the finance tracker to the state before the previous undoable command was executed or
before the specified number of undoable commands were executed.

[NOTE]
`undo` is not executable for Statistics and UI commands.

Format: `undo` `undo <step>`

* `<step>`: The number of commands to undo. Additionally the step must be greater than zero and positive.
* `undo <step>` is only executed if the number of undoable commands is more than or equal to `<step>`.
* [NOTE] `undo 1` has the same function as `undo`.
[NOTE]
`undo 1` has the same function as `undo`.

Example Usage:
[start = 1]
Expand Down Expand Up @@ -897,11 +910,16 @@ Other examples:
==== Redo previously undone command : `redo`
Reverses the most recent undone command or the specified number of most recent undone commands.

[NOTE]
As `undo` is not executable for Statistics and UI commands, `redo` is not executable
for those commands as well.

Format: `redo` `redo <step>`

* `<step>`: The number of undone commands to redo. Additionally the step must be greater than zero and positive.
* `redo <step>` is only executed if the number of redoable commands is more than or equal to `<step>`.
* [NOTE] `redo 1` has the same function as `redo`.
[NOTE]
`redo 1` has the same function as `redo`.

Example Usage:
[start = 1]
Expand Down Expand Up @@ -950,7 +968,8 @@ Displays the list of commands entered, from most recent to earliest.

Format: `history`

* [NOTE] `history` can only be executed if there were commands already entered before trying to use `history`.
[NOTE]
`history` can only be executed if there were commands already entered before trying to use `history`.

Example Usage:
[start = 1]
Expand Down Expand Up @@ -1096,7 +1115,7 @@ do so.
.. `sortBudget typ/<sort type> s/<sort sequence>`
.. `sortWish typ/<sort type> s/<sort sequence>`
.. `findExpense [cat/<category>] [n/<description>] [amt/<amount>] [d/<date>] [t/<tag>]`
.. `findIncome [cat/<category>] [n/<description>] amt/<amount>] [d/<date>] [tg/<tag>]`
.. `findIncome [cat/<category>] [n/<description>] [amt/<amount>] [d/<date>] [tg/<tag>]`
.. `findBudget [cat/<category>] [n/<description>] [d/<date>] [tg/<tag>]`
.. `findWish [cat/<category>] [n/<description>] [amt/<amount>] [d/<date>] [tg/<tag>]`

Expand Down
Binary file modified docs/images/CommitActivityDiagram.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
59 changes: 14 additions & 45 deletions docs/team/rongrongrr.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,14 @@ History:
*** Updated the User Guide (Pull requests https://github.com/AY1920S1-CS2103-T16-4/main/pull/47[#47], https://github.com/AY1920S1-CS2103-T16-4/main/pull/303[#303])
** Community:
*** Reported bugs and suggestions for other teams (https://github.com/rongrongrr/ped/issues[PE dry run])
*** Set up the basic structure for the project. (Creation of budget classes, pull request https://github.com/AY1920S1-CS2103-T16-4/main/pull/67[#75])
*** Set up the basic structure for the project. (Creation of budget classes, pull request https://github.com/AY1920S1-CS2103-T16-4/main/pull/75[#75])

=== Contributions to the User Guide

|===
|_Given below are sections I contributed to the User Guide. They showcase my ability to write documentation targeting end-users._
|===

=== Undo/ Redo
==== Undo previous command : `undo`
Restores the finance tracker to the state before the previous undoable command was executed or
Expand All @@ -55,11 +59,7 @@ Format: `undo` `undo <step>`
Example Usage:
[start = 1]
. If you would like to delete a budget, whereby the budget is located at index 1 as shown below,
key in the command `deleteBudget 1`.
+
image::undo-1.png[]

. You should see the budget being deleted in the list of budgets as displayed below.
key in the command `deleteBudget 1`. You should see the budget being deleted in the list of budgets as displayed below.
+
image::undo-2.png[]

Expand Down Expand Up @@ -88,22 +88,6 @@ Format: `redo` `redo <step>`

Example Usage:
[start = 1]
. If you would like to delete a budget, whereby the budget is located at index 1 as shown below,
key in the command `deleteBudget 1`.
+
image::undo-1.png[]

. You should see the budget being deleted in the list of budgets as displayed below.
+
image::undo-2.png[]

. If you would like to undo your deletion, key in the command `undo`.
+
image::undo-3.png[]

. You should see the previously deleted budget back in the list of budgets as displayed below.
+
image::undo-4.png[]

. If you would like to redo your undone command, key in the command `redo'.
+
Expand Down Expand Up @@ -146,15 +130,16 @@ image::history-1.png[]
+
image::history-2.png[]

. If you would like to return the panel display to its original state, key in the command `list`.
+
image::history-3.png[]

. You should see that the income and expense panels are now back to their original positions.
. If you would like to return the panel display to its original state, key in the command `list`. You should see that the income and expense panels are now back to their original positions.
+
image::history-4.png[]

== Contributions to the Developer Guide

|===
|_Given below are sections I contributed to the Developer Guide. They showcase my ability to write technical documentation and the technical depth of my contributions to the project._
|===

=== Undo/ Redo

==== Implementation
Expand All @@ -172,23 +157,15 @@ Given below is an example usage scenario and how the undo/redo mechanism behaves

Step 1. The user launches the application for the first time. The `VersionedGuiltTrip` will be initialized with the initial finance tracker state, and the `currentStatePointer` pointing to that single finance tracker state.

image::UndoRedoState0.png[]

Step 2. The user executes `delete 5` command to delete the 5th entry in the finance tracker. The `delete` command calls `Model#commitGuiltTrip()`, causing the modified state of the finance tracker after the `delete 5` command executes to be saved in the `guiltTripStateList`, and the `currentStatePointer` is shifted to the newly inserted finance tracker state.
Step 2. The user executes `deleteExpense 5` command to delete the 5th entry in the finance tracker. The `deleteExpense` command calls `Model#commitGuiltTrip()`, causing the modified state of the finance tracker after the `deleteExpense 5` command executes to be saved in the `guiltTripStateList`, and the `currentStatePointer` is shifted to the newly inserted finance tracker state.

image::UndoRedoState1.png[]

Step 3. The user executes `add typ/Expense...` to add a new expense. The `add` command also calls `Model#commitGuiltTrip()`, causing another modified finance tracker state to be saved into the `guiltTripStateList`.

image::UndoRedoState2.png[]
Step 3. The user executes `addExpense...` to add a new expense. The `add` command also calls `Model#commitGuiltTrip()`, causing another modified finance tracker state to be saved into the `guiltTripStateList`.

[NOTE]
If a command fails its execution, it will not call `Model#commitGuiltTrip()`, so the finance tracker state will not be saved into the `guiltTripStateList`.

Step 4. The user now decides that adding the expense was a mistake, and decides to undo that action by executing the `undo` command. The `undo` command will call `Model#undoGuiltTrip()`, which will shift the `currentStatePointer` once to the left, pointing it to the previous finance tracker state, and restores the finance tracker to that state.

image::UndoRedoState3.png[]

[NOTE]
If the `currentStatePointer` is at index 0, pointing to the initial finance tracker state, then there are no previous finance tracker states to restore. The `undo` command uses `Model#canUndoGuiltTrip()` to check if this is the case. If so, it will return an error to the user rather than attempting to perform the undo.

Expand All @@ -205,16 +182,8 @@ If the `currentStatePointer` is at index `guiltTripStateList.size() - 1`, pointi

Step 5. The user then decides to execute the command `list`. Commands that do not modify the finance tracker, such as `list`, will usually not call `Model#commitGuiltTrip()`, `Model#undoGuiltTrip()` or `Model#redoGuiltTrip()`. Thus, the `guiltTripStateList` remains unchanged.

image::UndoRedoState4.png[]

Step 6. The user executes `clear`, which calls `Model#commitGuiltTrip()`. Since the `currentStatePointer` is not pointing at the end of the `guiltTripStateList`, all finance tracker states after the `currentStatePointer` will be purged. We designed it this way because it no longer makes sense to redo the `add typ/Expense ...` command. This is the behavior that most modern desktop applications follow.

image::UndoRedoState5.png[]

The following activity diagram summarizes what happens when a user executes a new command:

image::CommitActivityDiagram.png[]

==== Design Considerations

===== Aspect: How undo & redo executes
Expand Down

0 comments on commit 631a87f

Please sign in to comment.