Skip to content

Commit

Permalink
OpenstudHelper: Improve event parser
Browse files Browse the repository at this point in the history
  • Loading branch information
leosarra committed Nov 1, 2018
1 parent da81f34 commit eea0890
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/main/java/lithium/openstud/driver/core/OpenstudHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,22 @@ public static List<ExamDone> sortByDate(List<ExamDone> list, boolean ascending)
return list;
}

public static List<Lesson> sortLessonsByStartDate(List<Lesson> list, boolean ascending) {
Collections.sort(list, (o1, o2) -> {
if (o1.getStart() == null && o2.getStart() == null) return 0;
if (ascending)
if (o1.getStart() == null) return 1;
else if (o2.getStart() == null) return -1;
else return o1.getStart().compareTo(o2.getStart());
else {
if (o1.getStart() == null) return -1;
else if (o2.getStart()== null) return 1;
else return o2.getStart().compareTo(o1.getStart());
}
});
return list;
}

public static List<ExamDone> sortByGrade(List<ExamDone> list, boolean ascending) {
Collections.sort(list, (o1, o2) -> {
if (ascending)
Expand Down

0 comments on commit eea0890

Please sign in to comment.