Skip to content

Commit

Permalink
Merge pull request nus-cs2103-AY2223S2#118 from shaowi/list-command-b…
Browse files Browse the repository at this point in the history
…ug-fix

Fix error on list command
  • Loading branch information
lennoxtr authored Mar 18, 2023
2 parents 6bd761f + 1ab8626 commit 58fab50
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions src/main/java/seedu/address/model/ModelManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public class ModelManager implements Model {
private final Tracker tracker;
private final UserPrefs userPrefs;
private final Navigation navigation;
private final FilteredList<? extends ReadOnlyModule> filteredModules;
private FilteredList<? extends ReadOnlyModule> filteredModules;
private FilteredList<? extends ReadOnlyLecture> filteredLectures;
private FilteredList<? extends Video> filteredVideos;
private Level lastListLevel;
Expand Down Expand Up @@ -241,6 +241,7 @@ public ObservableList<? extends ReadOnlyModule> getFilteredModuleList() {
@Override
public void updateFilteredModuleList(Predicate<? super ReadOnlyModule> predicate) {
requireNonNull(predicate);
filteredModules = new FilteredList<>(this.tracker.getModuleList());
filteredModules.setPredicate(predicate);
setLastListLevel(Level.MODULE);

Expand All @@ -263,10 +264,7 @@ public ObservableList<? extends ReadOnlyLecture> getFilteredLectureList() {
@Override
public void updateFilteredLectureList(Predicate<? super ReadOnlyLecture> predicate, ReadOnlyModule module) {
requireNonNull(predicate);
if (filteredLectures == null) {
filteredLectures = new FilteredList<>(module.getLectureList());
}
requireNonNull(filteredLectures);
filteredLectures = new FilteredList<>(module.getLectureList());
filteredLectures.setPredicate(predicate);
setLastListLevel(Level.LECTURE);

Expand All @@ -286,10 +284,7 @@ public ObservableList<? extends Video> getFilteredVideoList() {
@Override
public void updateFilteredVideoList(Predicate<? super Video> predicate, ReadOnlyLecture lecture) {
requireNonNull(predicate);
if (filteredVideos == null) {
filteredVideos = new FilteredList<>(lecture.getVideoList());
}
requireNonNull(filteredVideos);
filteredVideos = new FilteredList<>(lecture.getVideoList());
filteredVideos.setPredicate(predicate);
setLastListLevel(Level.VIDEO);

Expand Down

0 comments on commit 58fab50

Please sign in to comment.