diff --git a/docs/UserGuide.md b/docs/UserGuide.md index 83f75151e3b..0a8bba929dd 100644 --- a/docs/UserGuide.md +++ b/docs/UserGuide.md @@ -122,6 +122,23 @@ EduContacts is a **desktop app for educators in tertiary institutions to manage 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.

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.

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.

The domain name is made up of domain labels separated by periods.

The domain name must:
- End with a domain label at least 2 characters long
- Have each domain label start and end with alphanumeric characters
- 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: `# , -`.

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.

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". --------------------------------------------------------------------------------------------------------------------
@@ -163,7 +180,8 @@ help ``` The help window will display the help message as shown in the screenshot below: -![help message](images/helpMessage.png) +help message + Alternatively, you can click the button on the top right hand corner as indicated here: ![alternative_help](images/alternativeHelp.png) @@ -213,7 +231,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)
@@ -233,7 +251,7 @@ edit ID [FIELD_TO_EDIT_PREFIX] [NEW_VALUE] 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) @@ -278,7 +296,7 @@ filter [KEYWORD_PREFIX] [MORE_KEYWORDS] * **For filtering by Module:** * Use prefix `m/`. - * Partial matching is supported, allowing users to input parts of module codes. e.g. `m/CS21` will match modules like "CS2103T" and "CS2101." + * Only full module codes will be matched, e.g. `m/CS2103T` will match the module "CS2103T", and not `m/CS21`. @@ -297,8 +315,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). + filter alex david - ![result for 'find alex david'](images/filterAlexDavidResult.png)
@@ -322,7 +340,7 @@ delete ID Examples: * `delete 15151515` will delete a person with student ID of `15151515` from EduContacts. -* `delete 71271222` will delete a person with student ID of `71271222` from EduContacts (the response message of this command is shown in the screenshot below). +* `delete 12345678` will delete a person with student ID of `12345678` from EduContacts (the response message of this command is shown in the screenshot below). ![result for 'delete_71271222'](images/deleteCommandResult.png) diff --git a/docs/images/addCommandResult.png b/docs/images/addCommandResult.png index 09220a068aa..6243e5c2c3a 100644 Binary files a/docs/images/addCommandResult.png and b/docs/images/addCommandResult.png differ diff --git a/docs/images/addModule.png b/docs/images/addModule.png deleted file mode 100644 index f5cb6f779a3..00000000000 Binary files a/docs/images/addModule.png and /dev/null differ diff --git a/docs/images/addModuleResult.png b/docs/images/addModuleResult.png new file mode 100644 index 00000000000..1dfb3a7673a Binary files /dev/null and b/docs/images/addModuleResult.png differ diff --git a/docs/images/deleteCommandResult.png b/docs/images/deleteCommandResult.png index 9b8502af9e2..fb4b6f4f9e9 100644 Binary files a/docs/images/deleteCommandResult.png and b/docs/images/deleteCommandResult.png differ diff --git a/docs/images/editCommandResult.png b/docs/images/editCommandResult.png index cd7f9defa84..d38ea9f270f 100644 Binary files a/docs/images/editCommandResult.png and b/docs/images/editCommandResult.png differ diff --git a/src/main/java/seedu/address/model/person/ModuleContainsKeywordsPredicate.java b/src/main/java/seedu/address/model/person/ModuleContainsKeywordsPredicate.java index efa638e3209..909ddb173d1 100644 --- a/src/main/java/seedu/address/model/person/ModuleContainsKeywordsPredicate.java +++ b/src/main/java/seedu/address/model/person/ModuleContainsKeywordsPredicate.java @@ -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 diff --git a/src/test/java/seedu/address/model/person/ModuleContainsKeywordsPredicateTest.java b/src/test/java/seedu/address/model/person/ModuleContainsKeywordsPredicateTest.java index 0b3680ee138..ec5b61d9491 100644 --- a/src/test/java/seedu/address/model/person/ModuleContainsKeywordsPredicateTest.java +++ b/src/test/java/seedu/address/model/person/ModuleContainsKeywordsPredicateTest.java @@ -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