diff --git a/docs/UserGuide.md b/docs/UserGuide.md index 1b67af9414e..db61a865d0f 100644 --- a/docs/UserGuide.md +++ b/docs/UserGuide.md @@ -271,7 +271,7 @@ The help window is resizable, so you can **easily reposition and resize** it to * On Windows and most Linux distributions, you can use the keyboard shortcut: {{ macros.keyFormat('Alt') }} + {{ macros.keyFormat('Tab') }}, to switch between windows quickly. -* On macOS, you can use the keyboard shortcut: {{ macros.keyFormat('⌘Cmd') }} + {{ macros.keyFormat('Tab') }}, to switch between windows quickly. +* On macOS, you can use the keyboard shortcut: {{ macros.keyFormat('⌘Cmd') }} + {{ macros.keyFormat('`') }}, to switch between windows quickly. @@ -290,12 +290,11 @@ The quick reference is meant for **fast and reliable** lookup of commands and th ### Name/Rename CS course : `setcrs` -Names the course in question. +Sets the course code in question. -Format: `setcrs COURSE_NAME` +Format: `setcrs COURSE_CODE` -Duplicate course are not allowed. -Courses are case-insensitive. +Course codes are case-insensitive. Course code should follow the format "XX1234Y", Y is optional. --- @@ -309,6 +308,8 @@ Format: `addstu n/NAME nn/NUSNET [p/PHONE] [e/EMAIL] [m/MAJOR] [t/TAG]…​` * Add a student with the given details. * The name and nusnet id must be provided. And nusnet id must be unique. + +* Name cannot be empty or spaces only, contain only alphabets and cannot have double spaces. * All the remaining fields are optional. If values are not provided to optional fields, they will be set to a placeholder value under the hood (e.g., `Major not provided` for `MAJOR` field). @@ -892,7 +893,7 @@ If you have more than one copy of TAPro running, the application may not functio | **Mark** | `mark nn/NUSNET wk/WEEK_NUMBER`
e.g., `mark nn/E1234567 wk/3` | | **Unmark** | `unmark nn/NUSNET wk/WEEK_NUMBER`
e.g., `unmark nn/E1234567 wk/3` | | **Find** | `find KEYWORD [MORE_KEYWORDS]…​`
e.g., `find James Jake` | -| **Set Course** | `setcrs COURSE_NAME` | +| **Set Course** | `setcrs COURSE_CODE` | | **List** | `list` | | **Help** | `help` | | **Exit** | `exit` | diff --git a/src/main/java/seedu/address/logic/Messages.java b/src/main/java/seedu/address/logic/Messages.java index 507a1958667..1b3ca134a03 100644 --- a/src/main/java/seedu/address/logic/Messages.java +++ b/src/main/java/seedu/address/logic/Messages.java @@ -102,7 +102,13 @@ public static String format(Person person) { .append("; Major: ") .append(person.getMajor()) .append("; Attendance: "); - person.getAttendance().forEach(builder::append); + String combinedString = person.getAttendance().stream() + .map(weekNumber -> weekNumber.toString() + ", ") + .collect(Collectors.joining()); + if (!combinedString.isEmpty()) { + combinedString = combinedString.substring(0, combinedString.length() - 2); + } + builder.append(combinedString); builder.append("; Tags: "); person.getTags().forEach(builder::append); return builder.toString(); diff --git a/src/main/java/seedu/address/logic/commands/EditPersonCommand.java b/src/main/java/seedu/address/logic/commands/EditPersonCommand.java index 92cbecd6fc7..11e160c139c 100644 --- a/src/main/java/seedu/address/logic/commands/EditPersonCommand.java +++ b/src/main/java/seedu/address/logic/commands/EditPersonCommand.java @@ -116,7 +116,6 @@ private static Person createEditedPerson(Person personToEdit, EditPersonDescript return new Person(updatedName, updatedPhone, updatedEmail, updatedNusNet, updatedMajor, updatedAttendance, updatedTags); } - @Override public boolean equals(Object other) { if (other == this) { @@ -169,7 +168,6 @@ public EditPersonDescriptor(EditPersonDescriptor toCopy) { setAttendance(toCopy.attendance); setTags(toCopy.tags); } - /** * Returns true if at least one field is edited. */ diff --git a/src/main/java/seedu/address/logic/commands/SetCourseCommand.java b/src/main/java/seedu/address/logic/commands/SetCourseCommand.java index b267c0aeec6..bf61e02c39c 100644 --- a/src/main/java/seedu/address/logic/commands/SetCourseCommand.java +++ b/src/main/java/seedu/address/logic/commands/SetCourseCommand.java @@ -23,10 +23,10 @@ public class SetCourseCommand extends Command { public static final String MESSAGE_USAGE = CommandMessageUsageUtil.generateMessageUsage( COMMAND_WORD, - "Sets the course name. ", + "Sets the course code. ", PARAMETER_COURSE_CODE); - public static final String MESSAGE_SUCCESS = "Successfully updated course name"; + public static final String MESSAGE_SUCCESS = "Successfully updated course code"; private final Course course; diff --git a/src/main/java/seedu/address/model/person/Name.java b/src/main/java/seedu/address/model/person/Name.java index 2156209f46b..b35a95d8e0d 100644 --- a/src/main/java/seedu/address/model/person/Name.java +++ b/src/main/java/seedu/address/model/person/Name.java @@ -14,7 +14,7 @@ public class Name { + "and should not be blank"; /* - * The first character of the address must not be a whitespace, + * The first character of the name must not be a whitespace, * otherwise " " (a blank string) becomes a valid input. */ public static final String VALIDATION_REGEX = "[A-Z][a-z]*(\\s[A-Z][a-z]*)*"; diff --git a/src/main/java/seedu/address/model/weeknumber/WeekNumber.java b/src/main/java/seedu/address/model/weeknumber/WeekNumber.java index 4ba94073372..c557c9a741b 100644 --- a/src/main/java/seedu/address/model/weeknumber/WeekNumber.java +++ b/src/main/java/seedu/address/model/weeknumber/WeekNumber.java @@ -31,12 +31,6 @@ public WeekNumber(String weekNumber) { public static boolean isValidWeekNumber(String test) { return test.matches(VALIDATION_REGEX); } - - @Override - public String toString() { - return value.toString(); - } - @Override public boolean equals(Object other) { if (other == this) { @@ -55,4 +49,8 @@ public boolean equals(Object other) { public int hashCode() { return value.hashCode(); } + @Override + public String toString() { + return value.toString(); + } } diff --git a/src/test/java/seedu/address/logic/commands/AddCommandTest.java b/src/test/java/seedu/address/logic/commands/AddCommandTest.java index c3ff35aaa67..d195d06be43 100644 --- a/src/test/java/seedu/address/logic/commands/AddCommandTest.java +++ b/src/test/java/seedu/address/logic/commands/AddCommandTest.java @@ -21,7 +21,6 @@ import seedu.address.commons.core.GuiSettings; import seedu.address.logic.Messages; import seedu.address.logic.commands.exceptions.CommandException; -import seedu.address.logic.commands.exceptions.InappropriateMethodCallAssertionError; import seedu.address.model.AddressBook; import seedu.address.model.CourseName; import seedu.address.model.Model; @@ -30,6 +29,7 @@ import seedu.address.model.ReadOnlyUserPrefs; import seedu.address.model.person.NusNet; import seedu.address.model.person.Person; +import seedu.address.testutil.InappropriateMethodCallAssertionError; import seedu.address.testutil.PersonBuilder; diff --git a/src/test/java/seedu/address/model/person/NameTest.java b/src/test/java/seedu/address/model/person/NameTest.java index 63e19349e96..923ac6078e9 100644 --- a/src/test/java/seedu/address/model/person/NameTest.java +++ b/src/test/java/seedu/address/model/person/NameTest.java @@ -31,6 +31,7 @@ public void isValidName() { assertFalse(Name.isValidName("peter*")); // contains non-alphanumeric characters assertFalse(Name.isValidName("12345")); // numbers only assertFalse(Name.isValidName("Peter The 2nd")); // alphanumeric characters + assertFalse(Name.isValidName("Peter T")); // Double space // valid name assertTrue(Name.isValidName("Peter Jack")); // alphabets only diff --git a/src/main/java/seedu/address/logic/commands/exceptions/InappropriateMethodCallAssertionError.java b/src/test/java/seedu/address/testutil/InappropriateMethodCallAssertionError.java similarity index 94% rename from src/main/java/seedu/address/logic/commands/exceptions/InappropriateMethodCallAssertionError.java rename to src/test/java/seedu/address/testutil/InappropriateMethodCallAssertionError.java index c881494b724..23cf8ff5c08 100644 --- a/src/main/java/seedu/address/logic/commands/exceptions/InappropriateMethodCallAssertionError.java +++ b/src/test/java/seedu/address/testutil/InappropriateMethodCallAssertionError.java @@ -1,4 +1,4 @@ -package seedu.address.logic.commands.exceptions; +package seedu.address.testutil; /** * InappropriateMethodCallAssertionError extends AssertionError to provide a more specific error indication