Skip to content

Commit

Permalink
Merge pull request #236 from JiaXinEu/branch-Version1.4
Browse files Browse the repository at this point in the history
Update version to v1.4
  • Loading branch information
ronnnnnnnnn authored Apr 15, 2024
2 parents ec48e80 + 96a732c commit f5b7fdd
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 93 deletions.
10 changes: 5 additions & 5 deletions docs/AboutUs.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ You can reach us at the email `seer[at]comp.nus.edu.sg`
[[github](https://github.com/JiaXinEu)]
[[portfolio](team/jiaxineu.md)]

* Role: Project Advisor

* Role: Developer
* Responsibilities: Testing

### Yashma Sonara

Expand All @@ -28,8 +28,8 @@ You can reach us at the email `seer[at]comp.nus.edu.sg`
[[github](https://github.com/yashma-sonara)]
[[portfolio](team/johndoe.md)]

* Role: Team Lead
* Responsibilities: UI
* Role: Developer
* Responsibilities: Documentation + Code Quality


### Ronn Ng
Expand All @@ -50,7 +50,7 @@ You can reach us at the email `seer[at]comp.nus.edu.sg`
[[portfolio](team/johndoe.md)]

* Role: Developer
* Responsibilities: Dev Ops + Threading
* Responsibilities: Archive-related Features


### Zhuo En
Expand Down
91 changes: 5 additions & 86 deletions docs/DeveloperGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ title: Developer Guide
## **Acknowledgements**

* The **CS2103T teaching team** for providing us with the [base project](https://github.com/nus-cs2103-AY2324S2/tp) that Teachstack builds upon, as well as for their invaluable guidance throughout this project's development.
* **Any other libaries or 3rd-party code** already used in the [base project](https://github.com/nus-cs2103-AY2324S2/tp). (see link for details) <br>

* __Any other libaries or 3rd-party code__ already used in the [base project](https://github.com/nus-cs2103-AY2324S2/tp). (see link for details) <br>
* The idea for **clickable email** was inspired from a similar feature in project [CodeConnect](https://github.com/AY2324S2-CS2103T-T12-1/tp).
--------------------------------------------------------------------------------------------------------------------

Expand Down Expand Up @@ -341,6 +340,8 @@ Here is the sequence diagram which shows the overall flow:

</div>

#### Design considerations:

**Aspect: Which model attribute to use for find**

* **Alternative 1 (current choice):** Filter by `Group`
Expand Down Expand Up @@ -576,6 +577,8 @@ The below sequence diagram displays the interactions while executing the command

### Save user data feature

#### Implementation

To make the application more user-friendly, we have implemented a feature which allows certain user data such as `thresholdGrade` and the previous filter applied by the `find` command to be saved in between sessions (i.e. after shutting down the application).

The main classes behind this feature are `JsonUserDataStorage`, `JsonSerializableUserData` and `JsonAdaptedField`. The storage classes function much like the storage for the address book and archived book, while `JsonAdaptedField` handles the user data, or fields, to be saved.
Expand Down Expand Up @@ -629,90 +632,6 @@ Proposed: <br>
Modifying the summary command to include an input, thereby allowing the user to also view summary of a group.


---------------------------------------------------------------------------------------------------------------------
### \[Proposed\] Undo/redo feature

#### Proposed Implementation

The proposed undo/redo mechanism is facilitated by `VersionedAddressBook`. It extends `AddressBook` with an undo/redo history, stored internally as an `addressBookStateList` and `currentStatePointer`. Additionally, it implements the following operations:
* `VersionedAddressBook#commit()` — Saves the current address book state in its history.
* `VersionedAddressBook#undo()` — Restores the previous address book state from its history.
* `VersionedAddressBook#redo()` — Restores a previously undone address book state from its history.

These operations are exposed in the `Model` interface as `Model#commitAddressBook()`, `Model#undoAddressBook()` and `Model#redoAddressBook()` respectively.

Given below is an example usage scenario and how the undo/redo mechanism behaves at each step.

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

![UndoRedoState0](images/UndoRedoState0.png)

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.

![UndoRedoState1](images/UndoRedoState1.png)

Step 3. The user executes `add n/David …​` to add a new person. The `add` command also calls `Model#commitAddressBook()`, causing another modified address book state to be saved into the `addressBookStateList`.

![UndoRedoState2](images/UndoRedoState2.png)

<div markdown="span" class="alert alert-info">:information_source: **Note:** If a command fails its execution, it will not call `Model#commitAddressBook()`, so the address book state will not be saved into the `addressBookStateList`.

</div>

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

![UndoRedoState3](images/UndoRedoState3.png)

<div markdown="span" class="alert alert-info">:information_source: **Note:** If the `currentStatePointer` is at index 0, pointing to the initial AddressBook state, then there are no previous AddressBook states to restore. The `undo` command uses `Model#canUndoAddressBook()` to check if this is the case. If so, it will return an error to the user rather
than attempting to perform the undo.

</div>

The following sequence diagram shows how an undo operation goes through the `Logic` component:

![UndoSequenceDiagram](images/UndoSequenceDiagram-Logic.png)

<div markdown="span" class="alert alert-info">:information_source: **Note:** The lifeline for `UndoCommand` should end at the destroy marker (X) but due to a limitation of PlantUML, the lifeline reaches the end of diagram.

</div>

Similarly, how an undo operation goes through the `Model` component is shown below:

![UndoSequenceDiagram](images/UndoSequenceDiagram-Model.png)

The `redo` command does the opposite — it calls `Model#redoAddressBook()`, which shifts the `currentStatePointer` once to the right, pointing to the previously undone state, and restores the address book to that state.

<div markdown="span" class="alert alert-info">:information_source: **Note:** If the `currentStatePointer` is at index `addressBookStateList.size() - 1`, pointing to the latest address book state, then there are no undone AddressBook states to restore. The `redo` command uses `Model#canRedoAddressBook()` to check if this is the case. If so, it will return an error to the user rather than attempting to perform the redo.

</div>

Step 5. The user then decides to execute the command `list`. Commands that do not modify the address book, such as `list`, will usually not call `Model#commitAddressBook()`, `Model#undoAddressBook()` or `Model#redoAddressBook()`. Thus, the `addressBookStateList` remains unchanged.

![UndoRedoState4](images/UndoRedoState4.png)

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. Reason: It no longer makes sense to redo the `add n/David …​` command. This is the behavior that most modern desktop applications follow.

![UndoRedoState5](images/UndoRedoState5.png)

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

<img src="images/CommitActivityDiagram.png" width="250" />

#### Design considerations:

**Aspect: How undo & redo executes:**

* **Alternative 1 (current choice):** Saves the entire address book.
* Pros: Easy to implement.
* 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.



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

## **Documentation, logging, testing, configuration, dev-ops**
Expand Down
2 changes: 1 addition & 1 deletion docs/UserGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -608,7 +608,7 @@ Displayed after the command: `summary`

| Action | Format, Examples |
|-----------------|-------------------------------------------------------------------------------------------------------------------------------------|
| **Add** | `add id/STUDENT_ID n/NAME e/EMAIL g/GRADE [gp/GROUP]...` <br> e.g., `add id/A0123459X n/James Doe e/[email protected] g/A` |
| **Add** | `add id/STUDENT_ID n/NAME e/EMAIL g/GRADE [gp/GROUP_NAME]...` <br> e.g., `add id/A0123459X n/James Doe e/[email protected] g/A` |
| **Delete** | `delete STUDENT_ID`<br> e.g., `delete A0123456X` |
| **Edit** | `edit STUDENT_ID [id/STUDENT_ID] [n/NAME] [e/EMAIL] [g/GRADE] [gp/GROUP_NAME]...` <br> e.g.,`edit A0123466C g/A+` |
| **View** | `view STUDENT_ID`<br> e.g., `view A0123466D` |
Expand Down
Binary file modified docs/images/Ui.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion src/main/java/seedu/teachstack/MainApp.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
*/
public class MainApp extends Application {

public static final Version VERSION = new Version(1, 3, 0, true);
public static final Version VERSION = new Version(1, 4, 0, true);

private static final Logger logger = LogsCenter.getLogger(MainApp.class);

Expand Down

0 comments on commit f5b7fdd

Please sign in to comment.