Skip to content

Commit

Permalink
Merge pull request AY2324S2-CS2103-F15-2#165 from AL-ZT/history-bugs
Browse files Browse the repository at this point in the history
Bug fix: History command + Misc.
  • Loading branch information
Hwww23 authored Apr 9, 2024
2 parents 1433d1f + 1d072f8 commit 7215559
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 19 deletions.
43 changes: 35 additions & 8 deletions docs/UserGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ Format: `list`

Edits an existing student in the address book.

Format: `edit INDEX [n/NAME] [p/PHONE] [e/EMAIL] [a/ADDRESS] [g/GRADE] [s/SUBJECT] [at/ATTENDANCE] [pa/PAYMENT] [d/DATETIME]…​ [t/TAG]…​`
Format: `edit INDEX [n/NAME] [p/PHONE_NUMBER] [e/EMAIL] [a/ADDRESS] [g/GRADE] [s/SUBJECT] [at/ATTENDANCE] [pa/PAYMENT] [d/DATETIME]…​ [t/TAG]…​`

* Refer to [Features](#features) to view the accepted grade inputs, and the [Filter](#filter-student-by-grade--subject--filter) command for `GRADE` and `SUBJECT` constraints.
* Edits the student at the specified `INDEX`. The index refers to the index number shown in the displayed student list. The index **must be a positive integer** 1, 2, 3, …​
Expand Down Expand Up @@ -198,14 +198,36 @@ Examples:

### Command history : `history`

Shows previous successful command history. Enter [list](#listing-all-students--list) to view the student list. Ignores saving `history` command itself.
There are two differing behaviours for this function.
* Lists down the last 10 successful commands in an independent command history list.
* Re-run commands based on the specified index.

Enter [list](#listing-all-students--list) to return back to the student list.

Format syntax and more information below.

Format: `history [INDEX]`

* Leaving whitespace / not entering index will list out the command history.
* The index refers to the index number shown in the displayed command history list.
* The index **must be a positive integer**, and should be within the list's boundaries.
* Lists previous 10 commands by default.
* Upon entering `history` (i.e. leaving whitespace / not entering any index):
* it will show a command history list, featuring a new, independent list showing previous successful commands.
* The command history list also ignores saving `history` command itself.
* Lists at most 10 successful commands.

* Upon entering `history [INDEX]`:
* It will re-run the command that was specified by the index.
* The index here refers to the index number shown in the command history list.
* The index **must be a positive integer**, and should be within the list's boundaries.
* The output message is determined by the re-run command. (i.e. `history [INDEX]` itself does not have any success message.)

Examples:

* `history` returns a command history list.
![history](images/commandHistory.png)

* `history 1` runs the `list` command and returns the student list. It also outputs the success message of `list`.
![history 1](images/commandHistory1.png)



### Clearing all entries : `clear`

Expand All @@ -232,9 +254,14 @@ If your changes to the data file makes its format invalid, AddressBook will disc
Furthermore, certain edits can cause the AddressBook to behave in unexpected ways (e.g., if a value entered is outside of the acceptable range). Therefore, edit the data file only if you are confident that you can update it correctly.
</div>

### Archiving data files `[coming in v2.0]`
--------------------------------------------------------------------------------------------------------------------

## Planned Enhancements

Team size: 4

_Details coming soon ..._
1. Improve readability of command history list: As of v1.3, the output of each command in the history is verbose, and introduces a lot of user-unfriendly code to the user. We plan to show only the command output that was typed by the user.
2. Comprehensiveness of error messages: Error messages for list indexes <= 0 are inconsistent with positive indexes, even though the index is compliant with the command format. Examples of commands requiring indexes are `delete`, `edit`, `history`. We plan to ensure consistency with the error message so long as it is an index value.

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

Expand Down
Binary file added docs/images/commandHistory.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/commandHistory1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/images/helpMessage.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ public class HistoryCommand extends Command {
public static final String COMMAND_WORD = "history";

public static final String MESSAGE_USAGE = COMMAND_WORD
+ ": Lists command history. Runs the command when index is specified. \n"
+ ": Lists command history. Runs the command when INDEX is specified. \n"
+ "Parameters: INDEX (must be a positive integer)\n"
+ "Example: " + COMMAND_WORD + " 1";
+ "Example: " + COMMAND_WORD + ", " + COMMAND_WORD + " 1";

public static final String MESSAGE_HISTORY_SUCCESS = "Command History listed.";

Expand Down
20 changes: 11 additions & 9 deletions src/main/java/seedu/address/ui/HelpWindow.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,27 +16,29 @@
public class HelpWindow extends UiPart<Stage> {

public static final String USERGUIDE_URL =
"https://github.com/AY2324S2-CS2103-F15-2/tp/blob/master/docs/UserGuide.md";
"https://ay2324s2-cs2103-f15-2.github.io/tp/UserGuide.html";
public static final String HELP_MESSAGE =
"Here are the list of commands that are available for use: \n"
+ " - Viewing help : 'help'\n\n"
+ " - Adding a student: 'add'\n"
+ " Usage: 'add n/NAME p/PHONE_NUMBER e/EMAIL a/ADDRESS [g/GRADE] [s/SUBJECT] "
+ "[d/DATETIME] [at/ATTENDANCE] [pa/PAYMENT] [t/TAG]…'\n\n"
+ "[at/ATTENDANCE] [pa/PAYMENT] [d/DATETIME] [t/TAG]…'\n\n"
+ " - Listing all persons : 'list'\n\n"
+ " - Editing a person : 'edit'\n"
+ " Usage: 'edit INDEX n/NAME p/PHONE_NUMBER e/EMAIL a/ADDRESS [g/GRADE] [s/SUBJECT] "
+ "[d/DATETIME] [at/ATTENDANCE] [pa/PAYMENT] [t/TAG]…'\n\n"
+ " Usage: 'edit INDEX [n/NAME] [p/PHONE_NUMBER] [e/EMAIL] [a/ADDRESS] [g/GRADE] [s/SUBJECT] "
+ "[at/ATTENDANCE] [pa/PAYMENT] [d/DATETIME] [t/TAG]…'\n\n"
+ " - Locating persons by name: 'find'\n"
+ " Usage: 'find KEYWORD [MORE_KEYWORDS]'\n\n"
+ " - Deleting a person : 'delete'\n"
+ " Usage: 'delete INDEX'\n\n"
+ " - Filter by Grade / Subject: 'filter [g/GRADE] [s/SUBJECT]'\n"
+ " Usage: 'filter g/A s/Maths'\n\n"
+ " - Categorise by Payment: 'payment pa/PAYMENT'\n"
+ " Usage: 'payment pa/Not Paid'\n\n"
+ " - Filtering by Grade / Subject: 'filter'\n"
+ " Usage: 'filter [g/GRADE] [s/SUBJECT]'\n\n"
+ " - Categorising by Payment: 'payment'\n"
+ " Usage: 'payment pa/PAYMENT'\n\n"
+ " - Viewing Calendar : 'view'\n\n"
+ " - Show previous successful commands : 'history'\n\n"
+ " - Showing list of previously successful commands : 'history'\n\n"
+ " - Executing command in command history list : 'history'\n"
+ " Usage: 'history [INDEX]'\n\n"
+ " - Clearing all entries : 'clear'\n\n"
+ " - Exiting the program : 'exit'\n\n"
+ "You can view the complete user guide at "
Expand Down

0 comments on commit 7215559

Please sign in to comment.