Skip to content

Commit

Permalink
Merge branch 'delete-command-tests' of https://github.com/jessica2828/tp
Browse files Browse the repository at this point in the history
 into delete-command-tests

* 'delete-command-tests' of https://github.com/jessica2828/tp: (44 commits)
  Update src/test/java/seedu/address/logic/commands/DeleteCommandTest.java
  Change prefix in Help Message
  Minor bug fixes
  Minor bug fixes
  Refactor Tag to Role in .puml files
  Add EditCommand test
  Minor checkstyle fix
  Add test case for GradeCommand
  Fix checkstyle issue
  Add test case for ModuleCommand
  Add test case
  Remove unnecessary print statements and add test cases
  Minor checkstyle fix
  Fix ModuleCommand, DeleteCommand and GradeCommand such that PersonDetails updates when these commands are called
  Shift capitalisation and lowercase logic into ParserUtil class
  Fix UG formatting in PDF
  Refactor Tag to Role
  Add test case to DeleteCommandTest
  Fix bugs related to Find Command and Delete Command
  Delete irrelevant test
  ...

# Conflicts:
#	docs/DeveloperGuide.md
  • Loading branch information
jessica2828 committed Nov 7, 2024
2 parents 773bf77 + 550f014 commit e45b866
Show file tree
Hide file tree
Showing 81 changed files with 1,014 additions and 577 deletions.
49 changes: 37 additions & 12 deletions docs/DeveloperGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,32 +77,53 @@ and consistent user experience.

The UI consists of a `MainWindow` that is made up of the following parts:
* `CommandBox`
* Where the user types in his desired command
* Where the user types in his desired command
* Integrates with [`CommandHistory`](#commandhistory-integration) to provide an efficient command-tracking mechanism, allowing users to navigate
through previously entered commands using the `UP` and `DOWN` arrow keys.
* `ResultDisplay`
* Where the resulting confirmation of the latest command sent or any corresponding error messages is shown to the user
* Where the resulting confirmation of the latest command sent or any corresponding error messages is shown to the user
* `PersonListPanel`
* The panel which holds the list of persons in EduContacts, each person represented by a `PersonCard`
* The panel which holds the list of persons in EduContacts, each person represented by a `PersonCard`
* `StatusBarFooter`
<<<<<<< HEAD
* Designed to show the save location of EduContacts' data
* `PersonDetails`
* A section of the UI that renders when a `FindCommand` is run, showing the resulting person's full details
=======
* Designed to show the save location of EduContacts' data
* `PersonDetails`
* A section of the UI that renders when a `FindCommand` is run, showing the resulting person's full details
>>>>>>> 550f0146c8868387d6e04d7b2929482db9d748df
* `PersonCard`
* Shows simple and brief details about a person
* Shows simple and brief details about a person
* `HelpWindow`
* Displayed by clicking the "Help" button at the top right hand of the screen
* Displayed by clicking the "Help" button at the top right hand of the screen

All these, including the `MainWindow`, inherit from the abstract `UiPart` class which captures the commonalities between
classes that represent parts of the visible GUI.

The `UI` component uses the JavaFx UI framework. The layout of these UI parts are defined in matching `.fxml` files that
<<<<<<< HEAD
are in the `src/main/resources/view` folder. For example, the layout of the [`MainWindow`](https://github.com/se-edu/addressbook-level3/tree/master/src/main/java/seedu/address/ui/MainWindow.java) is specified in [`MainWindow.fxml`](https://github.com/se-edu/addressbook-level3/tree/master/src/main/resources/view/MainWindow.fxml)
=======
are in the `src/main/resources/view` folder. For example, the layout of the
[`MainWindow`](https://github.com/se-edu/addressbook-level3/tree/master/src/main/java/seedu/address/ui/MainWindow.java)
is specified in [`MainWindow.fxml`](https://github.com/se-edu/addressbook-level3/tree/master/src/main/resources/view/MainWindow.fxml)
>>>>>>> 550f0146c8868387d6e04d7b2929482db9d748df
The `UI` component,
**The `UI` component,**

* executes user commands using the `Logic` component.
* listens for changes to `Model` data so that the UI can be updated with the modified data.
* keeps a reference to the `Logic` component, because the `UI` relies on the `Logic` to execute commands.
* depends on some classes in the `Model` component, as it displays `Person` object residing in the `Model`.

#### `CommandHistory` Integration

The `CommandHistory` class, located in `seedu.address.ui.util`, is responsible for tracking user-entered commands.
It enhances the `CommandBox` functionality by allowing users to navigate through their command history with the
`UP` and `DOWN` arrow keys. This design keeps the command history encapsulated and separate from other UI components,
promoting modularity and adhering to good OOP practices.

The stylesheet used for the UI can be found in `src/main/java/resources/view/LightTheme.css`.
### Logic component
Expand Down Expand Up @@ -147,15 +168,15 @@ How the parsing works:
The `Model` component,

* stores the contact data i.e., all `Person` objects (which are contained in a `UniquePersonList` object).
* a `Person` object stores `StudentId`, `Name`, `Address`, `Phone`, `Email`, `Tag`, `Course` objects.
* a `Person` object stores `StudentId`, `Name`, `Address`, `Phone`, `Email`, `Role`, `Course` objects.
* contains an ArrayList of `Module` objects which is optional.
* stores the currently 'selected' `Person` objects (e.g., results of a search query) as a separate _filtered_ list which is exposed to outsiders as an unmodifiable `ObservableList<Person>` that can be 'observed' e.g. the UI can be bound to this list so that the UI automatically updates when the data in the list change.
* stores a `UserPref` object that represents the user’s preferences. This is exposed to the outside as a `ReadOnlyUserPref` objects.
* is intentionally designed to be independent of other components (e.g., UI, Logic, Storage) to maintain a clean separation of concerns. This ensures that the Model layer is solely responsible for managing data and that data structures make sense on their own. This independence enables easier maintenance, testing, and adaptability of the data structures, as changes in one component (e.g., UI) do not affect the Model.

<box type="info" seamless>

**Note:** An alternative (arguably, a more OOP) model is given below. It has a `Role` list in the `AddressBook`, which `Person` references. This allows `AddressBook` to only require one `Role` object per unique tag, instead of each `Person` needing their own `Role` objects.<br>
**Note:** An alternative (arguably, a more OOP) model is given below. It has a `Role` list in the `AddressBook`, which `Person` references. This allows `AddressBook` to only require one `Role` object per unique role, instead of each `Person` needing their own `Role` objects.<br>

<puml src="diagrams/BetterModelClassDiagram.puml" width="450" />

Expand All @@ -168,10 +189,14 @@ The `Model` component,

<puml src="diagrams/StorageClassDiagram.puml" width="550" />

The `Storage` component,
* can save both address book data and user preference data in JSON format, and read them back into corresponding objects.
* inherits from both `AddressBookStorage` and `UserPrefStorage`, which means it can be treated as either one (if only the functionality of only one is needed).
* depends on some classes in the `Model` component (because the `Storage` component's job is to save/retrieve objects that belong to the `Model`)
The `Storage` component has a key role in persisting data across user sessions. Specifically, it,
* can save both EduContacts data and user preference data in JSON format. Upon application startup, it reads the saved JSON data back into the app, reconstructing it into the corresponding objects in the `Model` component.

* inherits from both `EduContactsStorage` and `UserPrefStorage`, which means it can be treated as either one (if only the functionality of only one is needed).

* depends on some classes in the `Model` component to serialize and deserialize data, because the `Storage` component's job is to save/retrieve objects that belong to the `Model`. This dependency allows it to handle domain-specific structures, like `Person` and `UserPrefs`, ensuring the saved data aligns with the current application state and structure.

* uses exception handling to manage file I/O issues (e.g., missing or corrupted files) and provides feedback to the user if data loading or saving encounters an issue, ensuring that the application can gracefully handle storage-related errors.

### Common classes

Expand Down
99 changes: 89 additions & 10 deletions docs/UserGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,26 +14,26 @@ EduContacts is a **desktop app for Educators in Tertiary Institution to manage c

<br>
<!-- * Table of Contents -->
<page-nav-print />

## Table of Contents
1. [Quick start](#quick-start)
2. [Features](#features)
- [Viewing help : `help`](#viewing-help-help)
- [Adding a person: `add`](#adding-a-person-add)
- [Listing all persons : `list`](#listing-all-persons-list)
- [Editing a person : `edit`](#editing-a-person-edit)
- [Grading a person : `grade`](#grading-a-person-grade)
- [Listing students by certain attributes : `filter`](#listing-students-by-certain-attributes-filter)
- [Adding a module to a student: `module`](#adding-a-module-to-a-student-module)
- [Deleting a person : `delete`](#deleting-a-person-delete)
- [Clearing all entries : `clear`](#clearing-all-entries-clear)
- [Exiting the program : `exit`](#exiting-the-program-exit)
3. [FAQ](#faq)
4. [Known issues](#known-issues)
5. [Command summary](#command-summary)

---

--------------------------------------------------------------------------------------------------------------------
<div style="page-break-after: always;"></div>

## Quick start

Expand Down Expand Up @@ -99,6 +99,7 @@ EduContacts is a **desktop app for Educators in Tertiary Institution to manage c
1. Refer to the [Features](#features) below for details of each command.

--------------------------------------------------------------------------------------------------------------------
<div style="page-break-after: always;"></div>

## Features

Expand Down Expand Up @@ -131,21 +132,28 @@ help
```
![help message](images/helpMessage.png)

Alternatively, you can click the button on the top right hand corner as indicated here:
![alternative_help](images/alternativeHelp.png)

<br>

### Adding a person: `add`

Adds a person contact to the EduContacts.

Format:
```bash
add ID n/NAME p/PHONE e/EMAIL a/ADDRESS c/COURSE t/TAG
add ID n/NAME p/PHONE e/EMAIL a/ADDRESS c/COURSE r/ROLE
```

Examples:
* `add 87654321 n/Betsy Crowe t/ Student e/[email protected] a/Blk 30 Geylang Street 29, #06-40 p/1234567 c/Business Analytics`
* `add 87654321 n/Betsy Crowe t/Student e/[email protected] a/Blk 30 Geylang Street 29, #06-40 p/1234567 c/Business Analytics`
* `add 12345678 n/John Doe p/98981212 e/[email protected] a/123 Jane Doe Road c/Computer Science t/Student`
* `add 71271222 n/Benson Boon p/89229191 e/[email protected] a/Blk 12 Benson Street c/Economics t/Student`
![result for 'add command result'](images/addCommandResult.png)

<br>

### Listing all persons : `list`

Shows a list of all persons in EduContacts.
Expand All @@ -154,6 +162,9 @@ Format:
```bash
list
```
![result for 'list command result'](images/listCommandResult.png)

<div style="page-break-after: always;"></div>

### Editing a person : `edit`

Expand All @@ -164,13 +175,35 @@ Format:
edit ID [FIELD_TO_EDIT_PREFIX] [NEW_VALUE]
```


* Edits a student's details according to the fields specified.
* At least one of the optional fields must be provided.
* Existing values will be updated to the input values.
Examples:
* To edit the module CS2103T to CS2101 of a student with ID 12345678, type `edit 12345678 m/CS2103T CS2101` utilizing the `m/` prefix for modules
* To edit the course of a student with ID 12121212 to Computer Science type `edit 12121212 c/Computer Science`
![result for 'edit command result'](images/editCommandResult.png)
<br>
### Adding a grade : `grade`
Adds a grade to a person's module

```bash
grade ID m/MODULE g/GRADE
```

* Adds a grade to a person according to the specified ID and Module
* Module specified must exist prior to execution grade command
* Acceptable grades: `A+, A, A-, B+, B, B-, C+, C, D+, D, F`
* Existing grade will be updated to the input grade

Examples:
* `grade 23876767 m/CS2103T g/A` will assign an A grade to the CS2103T module of a Person whose ID is 23876767

<br>

### Listing students by certain attributes : `filter`

Expand Down Expand Up @@ -216,6 +249,23 @@ Examples:

![result for 'find alex david'](images/filterAlexDavidResult.png)

<div style="page-break-after: always;"></div>

### Adding a module to a student: `module`

Adds a module to a specific student using their ID.

Format:
```bash
module ID m/MODULE
```

Examples:
* `module 12345678 m/CS2103T`
![result for 'add module result'](images/addModule.png)

<br>

### Deleting a person : `delete`

Deletes the specified person from EduContacts.
Expand All @@ -228,7 +278,23 @@ delete ID
* Deletes student with the specified `ID`.

Examples:
* `delete 12345678` will delete student contact with `ID: 12345678`.
* `delete 71271222` will delete student contact with `ID: 71271222`.
![result for 'delete_71271222'](images/filterAlexDavidResult.png)

<br>

### Finding a person : `find`

Finds the specified person from EduContacts and displays their details.

Format: `find ID`

* Finds student with the specified `ID`.

Examples:
* `find 12345678` will find student contact with `ID: 12345678` and display their details.

<div style="page-break-after: always;"></div>

### Clearing all entries : `clear`

Expand All @@ -246,6 +312,8 @@ The `clear` command will erase all contacts from the system. Please ensure that

</box>

<br>

### Exiting the program : `exit`

Exits the program.
Expand All @@ -261,10 +329,14 @@ exit
Use the UP and DOWN arrow keys to scroll through previous commands in the Command Box. This feature helps you reuse recent commands without retyping, making it faster to correct or repeat commands.
</box>

<br>

### Saving the data

EduContacts data are saved in the hard disk automatically after any command that changes the data. There is no need to save manually.

<br>

### Editing the data file

EduContacts data are saved automatically as a JSON file `[JAR file location]/data/educontacts.json`. Advanced users are welcome to update data directly by editing that data file.
Expand All @@ -276,11 +348,14 @@ If your changes to the data file makes its format invalid, EduContacts will disc
Furthermore, certain edits can cause the EduContacts to behave in unexpected ways (e.g., if a value entered is outside the acceptable range). Therefore, edit the data file only if you are confident that you can update it correctly.
</box>

<br>

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

_Details coming soon ..._

--------------------------------------------------------------------------------------------------------------------
<div style="page-break-after: always;"></div>

## FAQ

Expand All @@ -304,15 +379,19 @@ _Details coming soon ..._
2. **If you minimize the Help Window** and then run the `help` command (or use the `Help` menu, or the keyboard shortcut `F1`) again, the original Help Window will remain minimized, and no new Help Window will appear. The remedy is to manually restore the minimized Help Window.

--------------------------------------------------------------------------------------------------------------------
<div style="page-break-after: always;"></div>

## Command summary

Action | Format, Examples
-----------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------
**Add** | `add ID n/NAME p/PHONE e/EMAIL a/ADDRESS c/COURSE t/TAG` <br> e.g., `add 12345678 n/John Doe p/99999999 e/[email protected] a/123 Jane Doe Road c/Computer Science t/Student`
**Add** | `add ID n/NAME p/PHONE e/EMAIL a/ADDRESS c/COURSE r/ROLE` <br> e.g., `add 12345678 n/John Doe p/99999999 e/[email protected] a/123 Jane Doe Road c/Computer Science t/Student`
**Clear** | `clear`
**Delete** | `delete ID`<br> e.g., `delete 12345678`
**Edit** | `edit ID [n/NAME] [p/PHONE_NUMBER] [e/EMAIL] [a/ADDRESS] [c/COURSE] [t/TAG]…​`<br> e.g.,`edit 12345678 p/91234567 e/[email protected]`
**Filter** | `find [n/NAME] [c/COURSE] [m/MODULE]`<br> e.g., `find n/James Jake`
**Edit** | `edit ID [n/NAME] [p/PHONE_NUMBER] [e/EMAIL] [a/ADDRESS] [c/COURSE] [r/ROLE]…​`<br> e.g.,`edit 12345678 p/91234567 e/[email protected]`
**Grade** | `grade ID m/MODULE g/GRADE` <br> e.g. `grade 12345678 m/CS2103T g/A`
**Add Module** | `module ID [m/MODULE]` <br> e.g., `add 12345678 m/CS2103T`
**Filter** | `filter [n/NAME] [c/COURSE] [m/MODULE]`<br> e.g., `filter n/James Jake`
**Find** | `find ID`<br> e.g., `find 12345678`
**List** | `list`
**Help** | `help`
2 changes: 1 addition & 1 deletion docs/diagrams/BetterModelClassDiagram.puml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Person *--> Email
Person *--> StudentId
Person *--> Address
Person *--> Course
Person *--> Tag
Person *--> Role
Person *--> "*"Module

Module *--> "0..1" Grade
Expand Down
4 changes: 2 additions & 2 deletions docs/diagrams/ModelClassDiagram.puml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Class Course
Class Email
Class Name
Class Phone
Class Tag
Class Role
Class Module
Class Grade

Expand All @@ -46,7 +46,7 @@ Person *--> Name
Person *--> Phone
Person *--> Email
Person *--> Address
Person *--> "*" Tag
Person *--> "*" Role
Person *--> Course
Person *--> Module

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.
Binary file added docs/images/addCommandResult.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/addModule.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/alternativeHelp.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/deleteCommandResult.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/editCommandResult.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.
Binary file added docs/images/listCommandResult.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 0 additions & 1 deletion docs/site.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"baseUrl": "",
"titlePrefix": "EduContacts",
"titleSuffix": "AddressBook Level-3",
"faviconPath": "images/SeEduLogo.png",
"style": {
"codeTheme": "light"
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/seedu/address/logic/Messages.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ public static String format(Person person) {
.append(person.getAddress())
.append("; Course: ")
.append(person.getCourse())
.append("; Tag: ")
.append(person.getTag());
.append("; Role: ")
.append(person.getRole());
return builder.toString();
}

Expand Down
Loading

0 comments on commit e45b866

Please sign in to comment.