Skip to content

Commit

Permalink
Merge pull request #276 from Anant1902/branch-FixAttendanceToString
Browse files Browse the repository at this point in the history
Improved attendance display on result screen
  • Loading branch information
Anant1902 authored Apr 10, 2024
2 parents 1c88cca + e1dcec6 commit 92775d6
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
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
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();
}
}

0 comments on commit 92775d6

Please sign in to comment.