Skip to content

Commit

Permalink
Merge pull request #117 from AY2324S2-CS2103-F08-4/revert-115-master
Browse files Browse the repository at this point in the history
Revert "Fix Tests"
  • Loading branch information
joelgoh1 authored Apr 11, 2024
2 parents f405400 + ff27f88 commit f480ce4
Show file tree
Hide file tree
Showing 13 changed files with 26 additions and 40 deletions.
16 changes: 1 addition & 15 deletions docs/UserGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,6 @@ Examples:
* `add n/John Doe p/98765432 e/[email protected] a/John street, block 123, #01-01`
* `add n/Betsy Crowe e/[email protected] a/Newgate Prison p/1234567 t/Saturday 5pm-7pm g/ca1: 2 g/ca2: 80`

Refer to the [Accepted Parameters](#accepted-parameters) below for details of each command.

### Listing all students : `list`

Shows a list of all students in the address book.
Expand All @@ -118,8 +116,6 @@ Examples:
* `edit 1 !p` will display `edit 1 phone: {current phone number}`, prompting user to make changes to the phone number of the 1st student.
* `edit 2 !g` will display `edit 2 grade: {current grades}`, prompting user to modify (add/edit/delete) grades of the 2nd student.

Refer to the [Accepted Parameters](#accepted-parameters) below for details of each command.

### Locating students by name: `find`

Finds students whose names contain any of the given keywords.
Expand Down Expand Up @@ -224,17 +220,7 @@ Furthermore, certain edits can cause TutorTrack to behave in unexpected ways (e.
1. **When using multiple screens**, if you move the application to a secondary screen, and later switch to using only the primary screen, the GUI will open off-screen. The remedy is to delete the `preferences.json` file created by the application before running the application again.

--------------------------------------------------------------------------------------------------------------------
## Accepted Parameters
| Prefix | Stands for | Length | Accepted Characters |
|--------------|------------------------------------------------------------------------------------------------------------|--------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| **n/ or !n** | name | 1 - 80 | Must start with a letter, followed by any combinations of letters, spaces, `'`, "/", "\", "," and `-`, and end with a letter. Letters can be of any language. |
| **p/ or !p** | Singapore phone number beginning with `6`, `8` or `9` | 8 | Must start with a `6`, `8` or `9` and only contain numbers. |
| **e/ or !e** | Email | - | Must be of the format: `local-part@domain`. <br/> Local part should start with a alphanumeric character, only contain alphanumeric characters and `+`, `_`. `.`. `-` <br/> 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. |
| **a/ or !a** | Address | 100 | Can take any value. | |
| **t/ or !t** | Timeslot | - | Timeslot should be of the format: `DayOfWeek StartTime-EndTime`. <br/> The DayOfWeek is any day from Monday to Sunday. <br/> StartTime and EndTime include hours and optional minutes in 12-hour format, StartTime must be earlier than EndTime. Minutes, if included, should be separated from hours by a colon. | |
| **g/ or !g** | TestName and Grade. Grade represents the percentage gotten in the test rounded to the nearest whole number | - | Grades should be of the format `TestName: Grade` <br/> The TestName should not be empty. This is followed by a `: ` and then a grade which must be a whole number between [0, 100] |
| **r/** | Reverse the order of sort | - | Does not require any input after prefix | |
--------------------------------------------------------------------------------------------------------------------

## Command summary

| Action | Format, Examples |
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/seedu/address/model/student/Address.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public class Address {
* The first character of the address must not be a whitespace,
* otherwise " " (a blank string) becomes a valid input.
*/
public static final String VALIDATION_REGEX = "[^\\s].{0,99}";
public static final String VALIDATION_REGEX = "[^\\s].*";

public final String value;

Expand Down
4 changes: 2 additions & 2 deletions src/main/java/seedu/address/model/student/Name.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@
public class Name {

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

/*
* The first character of the address must not be a whitespace,
* otherwise " " (a blank string) becomes a valid input.
*/
public static final String VALIDATION_REGEX = "^[\\p{L}][\\p{L} '/\\-,]{0,78}[\\p{L}]$";
public static final String VALIDATION_REGEX = "[\\p{Alnum}][\\p{Alnum} ]*";

public final String fullName;

Expand Down
6 changes: 3 additions & 3 deletions src/main/java/seedu/address/model/student/Phone.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
public class Phone {


public static final String MESSAGE_CONSTRAINTS = "Phone numbers should only contain numbers, "
+ "start with 6, 8 or 9 and it should be between 3 to 8 digits long";
public static final String VALIDATION_REGEX = "^[689]\\d{2,7}$";
public static final String MESSAGE_CONSTRAINTS =
"Phone numbers should only contain numbers, and it should be at least 3 digits long";
public static final String VALIDATION_REGEX = "\\d{3,}";
public final String value;

/**
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/seedu/address/model/timeslots/Timeslots.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public class Timeslots {
+ "DayOfWeek StartTime-EndTime, and adhere to the following constraints:\n"
+ "1. The DayOfWeek is any day from Monday to Sunday.\n"
+ "2. StartTime and EndTime include hours and optional minutes in 12-hour format. \n"
+ "3. StartTime must be earlier than EndTime. "
+ "23. StartTime must be earlier than EndTime. "
+ "Minutes, if included, should be separated from hours by a colon. \n"
+ "For example, 'Saturday 4pm-6pm', 'Tuesday 2:30pm-4:30pm'.\n";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,21 +30,21 @@
"grades": [ ]
}, {
"name" : "Elle Meyer",
"phone" : "94822243",
"phone" : "9482224",
"email" : "[email protected]",
"address" : "michegan ave",
"timeslots" : [ ],
"grades": [ ]
}, {
"name" : "Fiona Kunz",
"phone" : "94824273",
"phone" : "9482427",
"email" : "[email protected]",
"address" : "little tokyo",
"timeslots" : [ ],
"grades": [ ]
}, {
"name" : "George Best",
"phone" : "64824421",
"phone" : "9482442",
"email" : "[email protected]",
"address" : "4th street",
"timeslots" : [ ],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ public class CommandTestUtil {

public static final String VALID_NAME_AMY = "Amy Bee";
public static final String VALID_NAME_BOB = "Bob Choo";
public static final String VALID_PHONE_AMY = "68686868";
public static final String VALID_PHONE_BOB = "88888888";
public static final String VALID_PHONE_AMY = "11111111";
public static final String VALID_PHONE_BOB = "22222222";
public static final String VALID_EMAIL_AMY = "[email protected]";
public static final String VALID_EMAIL_BOB = "[email protected]";
public static final String VALID_ADDRESS_AMY = "Block 312, Amy Street 1";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public class ParserUtilTest {
private static final String INVALID_TIMESLOT = "Moonday";

private static final String VALID_NAME = "Rachel Walker";
private static final String VALID_PHONE = "98765432";
private static final String VALID_PHONE = "123456";
private static final String VALID_ADDRESS = "123 Main Street #0505";
private static final String VALID_EMAIL = "[email protected]";
private static final String VALID_TIMESLOT_1 = "Monday 3pm-5pm";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public void test_nameDoesNotContainKeywords_returnsFalse() {

// Keywords match phone, email and address, but does not match name
predicate = new NameContainsKeywordsPredicate(Arrays.asList("12345", "[email protected]", "Main", "Street"));
assertFalse(predicate.test(new StudentBuilder().withName("Alice").withPhone("99912345")
assertFalse(predicate.test(new StudentBuilder().withName("Alice").withPhone("12345")
.withEmail("[email protected]").withAddress("Main Street").build()));
}

Expand Down
5 changes: 3 additions & 2 deletions src/test/java/seedu/address/model/student/NameTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,10 @@ public void isValidName() {

// valid name
assertTrue(Name.isValidName("peter jack")); // alphabets only
assertTrue(Name.isValidName("David Roger s/o Jackson")); // special characters
assertTrue(Name.isValidName("12345")); // numbers only
assertTrue(Name.isValidName("peter the 2nd")); // alphanumeric characters
assertTrue(Name.isValidName("Capital Tan")); // with capital letters
assertTrue(Name.isValidName("David Roger Jackson Ray Jr the third")); // long names
assertTrue(Name.isValidName("David Roger Jackson Ray Jr 2nd")); // long names
}

@Test
Expand Down
3 changes: 1 addition & 2 deletions src/test/java/seedu/address/model/student/PhoneTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,12 @@ public void isValidPhone() {
assertFalse(Phone.isValidPhone("91")); // less than 3 numbers
assertFalse(Phone.isValidPhone("phone")); // non-numeric
assertFalse(Phone.isValidPhone("9011p041")); // alphabets within digits
assertFalse(Phone.isValidPhone("42344444")); // doesn't start with 6, 8, or 9
assertFalse(Phone.isValidPhone("9312 1534")); // spaces within digits

// valid phone numbers
assertTrue(Phone.isValidPhone("911")); // exactly 3 numbers
assertTrue(Phone.isValidPhone("93121534"));
assertTrue(Phone.isValidPhone("89891828")); // long phone numbers
assertTrue(Phone.isValidPhone("124293842033123")); // long phone numbers
}

@Test
Expand Down
4 changes: 2 additions & 2 deletions src/test/java/seedu/address/model/student/StudentTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ public void isSamestudent() {
assertFalse(BOB.isSameStudent(editedBob));

// name has trailing spaces, all other attributes same -> returns false
String nameWithTrailingCharacter = VALID_NAME_BOB + "e";
editedBob = new StudentBuilder(BOB).withName(nameWithTrailingCharacter).build();
String nameWithTrailingSpaces = VALID_NAME_BOB + " ";
editedBob = new StudentBuilder(BOB).withName(nameWithTrailingSpaces).build();
assertFalse(BOB.isSameStudent(editedBob));
}

Expand Down
10 changes: 5 additions & 5 deletions src/test/java/seedu/address/testutil/TypicalStudents.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,17 +40,17 @@ public class TypicalStudents {
.withEmail("[email protected]").withAddress("wall street").build();
public static final Student DANIEL = new StudentBuilder().withName("Daniel Meier").withPhone("87652533")
.withEmail("[email protected]").withAddress("10th street").withTimeslots("Tuesday 7pm-9pm").build();
public static final Student ELLE = new StudentBuilder().withName("Elle Meyer").withPhone("94822243")
public static final Student ELLE = new StudentBuilder().withName("Elle Meyer").withPhone("9482224")
.withEmail("[email protected]").withAddress("michegan ave").build();
public static final Student FIONA = new StudentBuilder().withName("Fiona Kunz").withPhone("94824273")
public static final Student FIONA = new StudentBuilder().withName("Fiona Kunz").withPhone("9482427")
.withEmail("[email protected]").withAddress("little tokyo").build();
public static final Student GEORGE = new StudentBuilder().withName("George Best").withPhone("64824421")
public static final Student GEORGE = new StudentBuilder().withName("George Best").withPhone("9482442")
.withEmail("[email protected]").withAddress("4th street").build();

// Manually added
public static final Student HOON = new StudentBuilder().withName("Hoon Meier").withPhone("84824242")
public static final Student HOON = new StudentBuilder().withName("Hoon Meier").withPhone("8482424")
.withEmail("[email protected]").withAddress("little india").build();
public static final Student IDA = new StudentBuilder().withName("Ida Mueller").withPhone("84821313")
public static final Student IDA = new StudentBuilder().withName("Ida Mueller").withPhone("8482131")
.withEmail("[email protected]").withAddress("chicago ave").build();

// Manually added - student's details found in {@code CommandTestUtil}
Expand Down

0 comments on commit f480ce4

Please sign in to comment.