Skip to content

Commit

Permalink
Merge pull request #56 from leepoeaik/master
Browse files Browse the repository at this point in the history
update lesson labels to not display when completed
  • Loading branch information
leepoeaik authored Mar 25, 2024
2 parents dafb1e6 + ece91b3 commit 11e6056
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/main/java/seedu/address/model/student/Lesson.java
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,6 @@ public int hashCode() {
* Format state as text for viewing.
*/
public String toString() {
return '[' + value + ']';
return this.subject + " " + this.date.toString() + " " + this.time;
}
}
4 changes: 2 additions & 2 deletions src/main/java/seedu/address/ui/StudentCard.java
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public StudentCard(Student student, int displayedIndex) {
subject.setText(student.getSubject().value);
remark.setText(student.getRemark().value);
student.getLessons().stream()
.sorted(Comparator.comparing(Lesson::getLessonValue))
.forEach(lesson -> lessons.getChildren().add(new Label(lesson.getLessonValue())));
.sorted(Comparator.comparing(Lesson::getLessonValue)).filter(lesson -> lesson.getLessonStatus() == 0)
.forEach(lesson -> lessons.getChildren().add(new Label(lesson.toString())));
}
}
15 changes: 15 additions & 0 deletions src/test/java/seedu/address/model/student/LessonTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,19 @@ public void equals() {
// different values -> returns false
assertFalse(lesson.equals(new Lesson("Science|01-01-2023|09:00|0")));
}

@Test
public void getLessonStatusIsValid() {
Lesson lesson1 = new Lesson("Math|01-01-2023|09:00|0");
assertEquals(lesson1.getLessonStatus(), 0);

Lesson lesson2 = new Lesson("Math|01-01-2023|09:00|1");
assertEquals(lesson2.getLessonStatus(), 1);
}

@Test
public void toStringTest() {
Lesson lesson = new Lesson("Math|01-01-2023|09:00|0");
assertEquals(lesson.toString(), "Math 2023-01-01 09:00");
}
}

0 comments on commit 11e6056

Please sign in to comment.