mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
fix navigation to next/previous task for empty task list
This commit is contained in:
+18
-2
@@ -41,7 +41,15 @@ public class StudyNavigator {
|
||||
if (nextLesson == null) {
|
||||
return null;
|
||||
}
|
||||
return StudyUtils.getFirst(nextLesson.getTaskList());
|
||||
List<Task> nextLessonTaskList = nextLesson.getTaskList();
|
||||
while (nextLessonTaskList.isEmpty()) {
|
||||
nextLesson = nextLesson(nextLesson);
|
||||
if (nextLesson == null) {
|
||||
return null;
|
||||
}
|
||||
nextLessonTaskList = nextLesson.getTaskList();
|
||||
}
|
||||
return StudyUtils.getFirst(nextLessonTaskList);
|
||||
}
|
||||
|
||||
public static Task previousTask(@NotNull final Task task) {
|
||||
@@ -55,7 +63,15 @@ public class StudyNavigator {
|
||||
return null;
|
||||
}
|
||||
//getting last task in previous lesson
|
||||
return prevLesson.getTaskList().get(prevLesson.getTaskList().size() - 1);
|
||||
List<Task> prevLessonTaskList = prevLesson.getTaskList();
|
||||
while (prevLessonTaskList.isEmpty()) {
|
||||
prevLesson = previousLesson(prevLesson);
|
||||
if (prevLesson == null) {
|
||||
return null;
|
||||
}
|
||||
prevLessonTaskList = prevLesson.getTaskList();
|
||||
}
|
||||
return prevLessonTaskList.get(prevLessonTaskList.size() - 1);
|
||||
}
|
||||
|
||||
public static Lesson nextLesson(@NotNull final Lesson lesson) {
|
||||
|
||||
Reference in New Issue
Block a user