Skip to content

Commit

Permalink
Merge branch 'master' into ug-fixes-final
Browse files Browse the repository at this point in the history
  • Loading branch information
jessica2828 authored Nov 11, 2024
2 parents 136caf0 + fc14b4a commit 1f8c472
Show file tree
Hide file tree
Showing 9 changed files with 25 additions and 13 deletions.
26 changes: 22 additions & 4 deletions docs/UserGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,23 @@ The `clear` command will erase all contacts from the system. Please ensure that

6. Refer to the [Features](#features) below for details of each command.

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

## Summary of a `Person`

This table will explain the fields that a `Person` in EduContacts possesses and its respective constraints. Each person
in EduContacts is assumed to be Singaporean. You should not leave any fields blank when adding a `Person` to EduContacts, except for `Module`.

Field | Details
-----------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------
**StudentID** | The student ID that belongs to the `Person`. The input for this field can only contain digits and should be exactly 8 digits long. <br><br> This field also serves as the unique identifier for a `Person`.
**Name** | The name that belongs to the `Person`. The input for this field can only contain alphanumeric characters and whitespaces.
**Course** | The course that the `Person` studies. The input for this field can only contain alphabetical characters and whitespaces.
**Email** | The email that belongs to the `Person`. The input for this field should be of the format local-part@domain. <br><br> The local-part should only contain alphanumeric characters and these special characters: `+ _ . -` The local-part may not start or end with any special characters. This is followed by a '@' and then a domain name. <br><br> The domain name is made up of domain labels separated by periods. <br><br> The domain name must: <br> - End with a domain label at least 2 characters long <br> - Have each domain label start and end with alphanumeric characters <br> - Have each domain label consist of alphanumeric characters, separated only by hyphens, if any.
**Address** | The address that belongs to the `Person`. The first character for the input for this field can only contain alphanumeric characters and these special characters: `# , -`. <br><br> After the first character, any additional characters are allowed, including whitespace and further text.
**Phone Number** | The phone number that belongs to the `Person`. The input for this field can only contain digits and must at least be 8 digits long.
**Module** | A module that the `Person` takes. A `Person` can have multiple modules. The input for this field can only contain alphanumeric characters. <br><br> A module can also be assigned a `Grade`, which must be one of the following: `A+, A, A-, B+, B, B-, C+, C, D+, D, F`
**Role** | The role assigned to the `Person`. A person can either be a "Student" or "Tutor".
--------------------------------------------------------------------------------------------------------------------
<div style="page-break-after: always;"></div>

Expand Down Expand Up @@ -184,8 +201,8 @@ help
```

The help window will display the help message as shown in the screenshot below:
![help message](images/helpMessage.png) <br>

<img src="images/helpMessage.png" alt="help message" width="500" height="auto">

Alternatively, you can click the button on the top right hand corner as indicated here:

Expand Down Expand Up @@ -244,7 +261,7 @@ Examples:
* `module 12345678 m/GEA1000` will add a module `GEA1000` to a person with student ID of `12345678`.
* `module 13131313 m/CS2103T` will add a module `CS2103T` to a person with student ID of `13131313` (the response message of this command is shown in the screenshot below).

![result for 'add module result'](images/addModule.png)
![result for 'add module result'](images/addModuleResult.png)

<br>

Expand Down Expand Up @@ -275,7 +292,7 @@ edit ID m/ OLD_MODULE NEW_MODULE

Examples:
* `edit 12345678 m/CS2103T CS2101` will edit a person with student ID of `12345678` by replacing the old module `CS2103T` with the new module `CS2101`.
* `edit 12121212 c/Computer Science` will edit a person with student ID of `12121212` by editing their course to `Computer Science` (the response message of this command is shown in the screenshot below).
* `edit 12345678 c/Computer Science` will edit a person with student ID of `12345678` by editing their course to `Computer Science` (the response message of this command is shown in the screenshot below).

![result for 'edit command result'](images/editCommandResult.png)

Expand Down Expand Up @@ -357,8 +374,8 @@ Examples:
* `filter m/CS2103T` will return a list of all persons with module `CS2103T`.
* `filter c/Computer Science` will return a list of all persons with course `Computer Science`.
* `filter n/alex david` will return a list of all persons with `alex` or `david` in their name e.g. `Alex Yeoh`, `David Li` (the result of this command is shown in the screenshot below).
<img src="images/filterAlexDavidResult.png" alt="filter alex david" width="600" height="auto">
![result for 'find alex david'](images/filterAlexDavidResult.png)
<br>
<box type="info" seamless>
Expand All @@ -381,6 +398,7 @@ delete ID
* Deletes person with the specified studentId.
Examples:
* `delete 15151515` will delete a person with studentId of `15151515` from EduContacts.
* `delete 71271222` will delete a person with studentId of `71271222` from EduContacts (the response message of this command is shown in the screenshot below).
Expand Down
Binary file modified 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 removed docs/images/addModule.png
Binary file not shown.
Binary file added docs/images/addModuleResult.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/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 modified 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.
6 changes: 1 addition & 5 deletions src/main/java/seedu/address/model/person/Module.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,8 @@
public class Module {

public static final String MESSAGE_CONSTRAINTS =
"Modules should only contain alphanumeric characters and spaces, and it should not be blank";
"Modules should only contain alphanumeric characters, and it should not be blank";

/*
* The first character of the Module must not be a whitespace,
* otherwise " " (a blank string) becomes a valid input.
*/
public static final String VALIDATION_REGEX = "^[a-zA-Z0-9]+$";

public final String value;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@ public ModuleContainsKeywordsPredicate(String keyword) {

@Override
public boolean test(Person person) {
String regex = "\\b" + keyword.toLowerCase() + "\\b";
return person.getModules().stream()
.anyMatch(module -> module.toString().toLowerCase().contains(keyword.toLowerCase()));
.anyMatch(module -> module.toString().toLowerCase().matches(".*" + regex + ".*"));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,6 @@ public void test_moduleContainsKeyword_returnsTrue() {

predicate = new ModuleContainsKeywordsPredicate("cs1010");
assertTrue(predicate.test(new PersonBuilder().addUngradedModule("CS1010").build()));

predicate = new ModuleContainsKeywordsPredicate("1010");
assertTrue(predicate.test(new PersonBuilder().addUngradedModule("CS1010").build()));
}

@Test
Expand Down

0 comments on commit 1f8c472

Please sign in to comment.