diff --git a/docs/UserGuide.md b/docs/UserGuide.md index 851f20b5811..6c8cb596e10 100644 --- a/docs/UserGuide.md +++ b/docs/UserGuide.md @@ -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.

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". --------------------------------------------------------------------------------------------------------------------
@@ -184,8 +201,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: @@ -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)
@@ -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) @@ -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). + filter alex david - ![result for 'find alex david'](images/filterAlexDavidResult.png)
@@ -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). 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/Module.java b/src/main/java/seedu/address/model/person/Module.java index ef9da2af436..afd8c4b4828 100644 --- a/src/main/java/seedu/address/model/person/Module.java +++ b/src/main/java/seedu/address/model/person/Module.java @@ -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; 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