fix move lesson

This commit is contained in:
Ekaterina Tuzova
2017-04-06 14:54:32 +03:00
parent f4bf5cc296
commit c89c64d8f3
4 changed files with 5 additions and 9 deletions
@@ -109,7 +109,7 @@ public class CCLessonMoveHandlerDelegate extends MoveHandlerDelegate {
newItemIndex - 1, EduNames.LESSON, 1);
sourceLesson.setIndex(newItemIndex);
Collections.sort(course.getLessons(), EduUtils.INDEX_COMPARATOR);
Collections.sort(course.getLessons(true), EduUtils.INDEX_COMPARATOR);
ApplicationManager.getApplication().runWriteAction(new Runnable() {
@Override
public void run() {
@@ -162,7 +162,7 @@ public class StudyProjectComponent implements ProjectComponent {
final ArrayList<Lesson> updatedLessons = new ArrayList<>();
int lessonIndex = 0;
for (Lesson lesson : course.getLessons()) {
for (Lesson lesson : course.getLessons(true)) {
lessonIndex += 1;
Lesson studentLesson = currentCourse.getLesson(lesson.getId());
final String lessonDirName = EduNames.LESSON + String.valueOf(lessonIndex);
@@ -48,8 +48,8 @@ public class Course {
return getLessons(false);
}
public List<Lesson> getLessons(boolean withAadditional) {
return withAadditional ? lessons
public List<Lesson> getLessons(boolean withAdditional) {
return withAdditional ? lessons
: lessons.stream().filter(lesson -> !EduNames.PYCHARM_ADDITIONAL.equals(lesson.getName())).collect(Collectors.toList());
}
@@ -64,11 +64,7 @@ public class StudyNavigator {
if (nextLessonIndex >= lessons.size()) {
return null;
}
final Lesson nextLesson = lessons.get(nextLessonIndex);
if (EduNames.PYCHARM_ADDITIONAL.equals(nextLesson.getName())) {
return null;
}
return nextLesson;
return lessons.get(nextLessonIndex);
}
public static Lesson previousLesson(@NotNull final Lesson lesson) {