New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update UG/DG and undo for training #188
Conversation
* 'master' of https://github.com/AY1920S1-CS2103T-T12-3/main: Update picture paths for UG Update UG styling Fix failing tests Abstract parseDate method in ParserUtil Fix trailing whitespace Add Ui.png Update UG and dot indicator colour to green Make event view background white Allow feature box to switch to view events when event is added Enable scrolling for viewing events Add sample Records Updated userguide Update sample persons to match athlete profiles Remove unused import Correct command prompts Update UI image with populated training and performance Update UI picture Edit UserGuide Update version
+ "undone any commands. As such, you are unable to redo any commands."; | ||
public static final String MESSAGE_FAILURE_EMPTY_STACK = "Redo Command Failure: No available " | ||
+ "commands to be redone."; | ||
public static final String MESSAGE_FAILURE = "Redo Command Failure:" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good improvement in the error message. just a point regarding grammar: should be "an" instead of "a"
} else { | ||
Command redoneCommand = model.redo(); | ||
if (redoneCommand instanceof TrainingCommand) { | ||
return new CommandResult(MESSAGE_SUCCESS, ((TrainingCommand) redoneCommand).getDate(), model); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good alteration of the commandresult to refresh the calendar to include the latest changes.
Training undoneTraining = this.attendance.getTrainings().remove(lastIndex); | ||
AthletickDate dateOfTraining = ((TrainingCommand) undoneCommand).getDate(); | ||
Training undoneTraining = this.attendance.getTrainingOnDate(dateOfTraining); | ||
this.attendance.getTrainings().remove(undoneTraining); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good update to account for the new implementation of attendance
* 'master' of https://github.com/AY1920S1-CS2103T-T12-3/main: Update for checkstyle Update calendar command error message to tell user range of month and year command Make entire command box clickable, resize command and result box Make long fields wrap Edit clear command to refresh calendar, update tests as well Wrap text to allow long event names to be seen fully Update Model stubs Enable clearing of performance data Adhere to CheckStyle Edit to pass test cases Correct error message Enable deleting athletes by -p flag (test cases not passed) Introduce flags
* 'master' of https://github.com/AY1920S1-CS2103T-T12-3/main: Add ability to replace existing trainings Update InformationDisplay to include gender Edit ClearCommand to delete Attendance data Add function to delete training Add template for test classes Add View Attendance command Add tests to Attendance and Training Edit calendar display to show training attendance in alphabetical order # Conflicts: # src/main/java/seedu/address/logic/commands/TrainingCommand.java
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good job on the improvements in Undo
and Redo
Junhup!
There are just a few grammatical errors and inconsistencies in the UG/DG.
Also, do consider making the UndoCommand
and RedoCommand
success more specific (eg. what in the command has been undone) for more clarity.
docs/DeveloperGuide.adoc
Outdated
|
||
Step 2. The user executes `delete 5` command to delete the 5th person in the address book. The `delete` command calls `Model#commitAddressBook()`, causing the modified state of the address book after the `delete 5` command executes to be saved in the `addressBookStateList`, and the `currentStatePointer` is shifted to the newly inserted address book state. | ||
Step 2. The user executes the delete 3 command to delete the 3rd person in the Athletick list. The delete command will be pushed into the commands stack in and the new state of the address book (after executing the delete command) will be pushed to the addressBooks stack as well. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reason for addressBook
and addressBooks
being used? There is some inconsistency here.
docs/DeveloperGuide.adoc
Outdated
|
||
Step 6. The user executes `clear`, which calls `Model#commitAddressBook()`. Since the `currentStatePointer` is not pointing at the end of the `addressBookStateList`, all address book states after the `currentStatePointer` will be purged. We designed it this way because it no longer makes sense to redo the `add n/David ...` command. This is the behavior that most modern desktop applications follow. | ||
How the redo feature works is very similar to how to undo feature work. The difference is that redo utilises the undoneCommands stack and the undoneAddressBook stack. As such, you can also refer to the diagrams in the Undo Implementation. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor edit to
How the redo feature works is very similar to how the undo feature works.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good eye!
docs/DeveloperGuide.adoc
Outdated
** Cons: May have performance issues in terms of memory usage. | ||
* **Alternative 2:** Individual command knows how to undo/redo by itself. | ||
** Pros: Will use less memory (e.g. for `delete`, just save the person being deleted). | ||
** Cons: We must ensure that the implementation of each individual command are correct. | ||
|
||
===== Aspect: Data structure to support the undo/redo commands | ||
====== Reason why we chose alternative 1: | ||
Even though the memory usage of Alternative 2 is lesser, we do not feel that the benefit of the usage of lesser memory outweigh the cost of implementing the alternative. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor edit to
outweighs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
okay thank you!
@@ -74,4 +74,8 @@ public boolean equals(Object other) { | |||
|| (other instanceof AddCommand // instanceof handles nulls | |||
&& toAdd.equals(((AddCommand) other).toAdd)); | |||
} | |||
@Override | |||
public String toString() { | |||
return "Add Person Command"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you included the Person
details here (eg. maybe even just the Name
), could it be possible to include more details in the UndoCommand
success other than just Add Person Command undone
?
Same for the other commands that have specific details (eg. Delete
and Edit
), so the user is more clear on what in particular has been undone.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll give it a shot
+ "undone any commands. As such, you are unable to redo any commands."; | ||
public static final String MESSAGE_SUCCESS = "Redo "; | ||
public static final String MESSAGE_FAILURE_EMPTY_STACK = "Redo Command Failure: No available " | ||
+ "commands to be redone."; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider changing to No available commands to redo.
return new CommandResult(MESSAGE_SUCCESS + redoneCommand | ||
+ " Success!", ((TrainingCommand) redoneCommand).getDate(), model); | ||
} else { | ||
return new CommandResult(MESSAGE_SUCCESS + redoneCommand |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider showing the user what command has been redone for more clarity.
return new CommandResult(MESSAGE_SUCCESS + undoneCommand | ||
+ " Success!", ((TrainingCommand) undoneCommand).getDate(), model); | ||
} else { | ||
return new CommandResult(MESSAGE_SUCCESS + undoneCommand |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By editing the toString
of the commands, perhaps this MESSAGE_SUCCESS
can be more personalised.
@@ -59,7 +59,7 @@ public InformationDisplay(Person selectedPerson, String attendance) { | |||
address.setText(this.person.getAddress().value); | |||
address.setPrefWidth(150); | |||
address.setWrapText(true); | |||
gender.setText(this.person.getGender().genderOfPerson); | |||
//gender.setText(this.person.getGender().genderOfPerson); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ChangUo79 remember to implement this in the FXML, otherwise this will be just dead code 😵.
…ds undo/redo implementation to similar to addressbook
* 'master' of https://github.com/AY1920S1-CS2103T-T12-3/main: (30 commits) Comply with checkstyle Updated for ModelStub Updated InformationDisplay Updated for performance display for selectCommand Test equality for Flag Adhere to CheckStyle Test DeleteEventCommand Test getFlag in DeleteCommandParser Make constructor public to allow for testing Test type parsers in DeleteCommandParser Fix EditCommand to change person details in training records Show generic message usage when no arguments are supplied Integrate DeleteTraining error message Recognise -t as a valid flag Add basic tests for Flag Updated to display performance Adhere to CheckStyle Modify to pass test cases Fix Flag toString error Give specific error messages for invalid inputs ... # Conflicts: # src/main/java/seedu/address/MainApp.java # src/main/java/seedu/address/model/training/Training.java # src/main/java/seedu/address/ui/InformationDisplay.java
* 'master' of https://github.com/AY1920S1-CS2103T-T12-3/main: Fix checkstyle errors Rename all "addressbook" to "athletick" Edit DeveloperGuide # Conflicts: # src/main/java/seedu/address/MainApp.java # src/main/java/seedu/address/logic/LogicManager.java # src/main/java/seedu/address/model/Model.java # src/main/java/seedu/address/model/ModelManager.java # src/main/java/seedu/address/model/history/HistoryManager.java
No description provided.