Skip to content

Commit

Permalink
Merge branch 'master' into ug-improve-faq
Browse files Browse the repository at this point in the history
  • Loading branch information
wxiaoyun authored Apr 12, 2024
2 parents 8d728a8 + 2b11168 commit c548bc7
Show file tree
Hide file tree
Showing 9 changed files with 24 additions and 20 deletions.
13 changes: 7 additions & 6 deletions docs/UserGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

</box>

Expand All @@ -290,12 +290,11 @@ The quick reference is meant for **fast and reliable** lookup of commands and th

### <i class="fa-solid fa-chalkboard"></i> 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.

<markdown class="d-print-none">---</markdown>
Expand All @@ -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).

<box type="tip" light>
Expand Down Expand Up @@ -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`<br> e.g., `mark nn/E1234567 wk/3` |
| **Unmark** | `unmark nn/NUSNET wk/WEEK_NUMBER`<br> e.g., `unmark nn/E1234567 wk/3` |
| **Find** | `find KEYWORD [MORE_KEYWORDS]…​`<br> e.g., `find James Jake` |
| **Set Course** | `setcrs COURSE_NAME` |
| **Set Course** | `setcrs COURSE_CODE` |
| **List** | `list` |
| **Help** | `help` |
| **Exit** | `exit` |
8 changes: 7 additions & 1 deletion src/main/java/seedu/address/logic/Messages.java
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -169,7 +168,6 @@ public EditPersonDescriptor(EditPersonDescriptor toCopy) {
setAttendance(toCopy.attendance);
setTags(toCopy.tags);
}

/**
* Returns true if at least one field is edited.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/seedu/address/model/person/Name.java
Original file line number Diff line number Diff line change
Expand Up @@ -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]*)*";
Expand Down
10 changes: 4 additions & 6 deletions src/main/java/seedu/address/model/weeknumber/WeekNumber.java
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -55,4 +49,8 @@ public boolean equals(Object other) {
public int hashCode() {
return value.hashCode();
}
@Override
public String toString() {
return value.toString();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;


Expand Down
1 change: 1 addition & 0 deletions src/test/java/seedu/address/model/person/NameTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package seedu.address.logic.commands.exceptions;
package seedu.address.testutil;

/**
* InappropriateMethodCallAssertionError extends AssertionError to provide a more specific error indication
Expand Down

0 comments on commit c548bc7

Please sign in to comment.