Skip to content

Commit

Permalink
Merge pull request #65 from leepoeaik/update-displayUpcomingLessons
Browse files Browse the repository at this point in the history
  • Loading branch information
justinlengch authored Apr 3, 2024
2 parents b55a7aa + a612858 commit 38fa4bd
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/main/java/seedu/address/ui/ScheduleListPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,17 @@ public class ScheduleListPanel extends UiPart<Region> {
public ScheduleListPanel(ObservableList<Student> studentList) {
super(FXML);

scheduleListView.setItems(TransformList(studentList));
scheduleListView.setItems(transformList(studentList));
scheduleListView.setCellFactory(listView -> new ScheduleListViewCell());
}

public ObservableList<Pair<Student, Lesson>> TransformList(ObservableList<Student> studentList) {
/**
* Extracts lessons from studentList
* Adds the lessons together with student as a pair and sorts it
* @param studentList observable list of students
* @return an observable list of a pair of students and lessons
*/
public ObservableList<Pair<Student, Lesson>> transformList(ObservableList<Student> studentList) {
List<Pair<Student, Lesson>> scheduleList = new ArrayList<>();
for (Student student : studentList) {
List<Lesson> studentLesson = student.getLessons();
Expand Down

0 comments on commit 38fa4bd

Please sign in to comment.