diff --git a/bin/App.class b/bin/App.class index c5db714..ac1ae08 100644 Binary files a/bin/App.class and b/bin/App.class differ diff --git a/src/App.java b/src/App.java index 97a132b..39a78c1 100644 --- a/src/App.java +++ b/src/App.java @@ -26,7 +26,7 @@ public class App { "&end=" + formattedEndDateTime.replace(" ", "%20")); } - private static void calculateBreakPoints(Break calcBreak, Teacher teacher) { + private static void calculateBreakPoints(Break calcBreak, Teacher teacher, Teacher nextTeacher) { int duration = calcBreak.getEnd() - calcBreak.getStart(); Co2Data[] minuteData = calcBreak.getCo2Datas(); @@ -48,8 +48,9 @@ public class App { teacher.addPoints(breakPoints, 0, 0); } - // bonus Point for teacher switch - + if (teacher.getShortName() != nextTeacher.getShortName()) { + // bonus Point for teacher switch + } } private static void initializeTeachers() { @@ -212,15 +213,25 @@ public class App { for (int i = 0; i < shortBreaks.length; i++) { Teacher teacher = findTeacherForBreak(i, timeTable, Arrays.asList(DATES).indexOf(date)); + Teacher nextTeacher = findTeacherForBreak(i + 1, timeTable, + Arrays.asList(DATES).indexOf(date)); if (teacher != null) { - calculateBreakPoints(shortBreaks[i], teacher); + if (nextTeacher == null) { + nextTeacher = teacher; + } + calculateBreakPoints(shortBreaks[i], teacher, nextTeacher); } } for (int i = 0; i < longBreaks.length; i++) { Teacher teacher = findTeacherForBreak(i, timeTable, Arrays.asList(DATES).indexOf(date)); + Teacher nextTeacher = findTeacherForBreak(i + 1, timeTable, + Arrays.asList(DATES).indexOf(date)); if (teacher != null) { - calculateBreakPoints(longBreaks[i], teacher); + if (nextTeacher == null) { + nextTeacher = teacher; + } + calculateBreakPoints(longBreaks[i], teacher, nextTeacher); } } } catch (Exception e) {