This commit is contained in:
Patrick_Pluto 2024-11-26 15:54:38 +01:00
parent bda5461576
commit c360825eb6
2 changed files with 16 additions and 5 deletions

Binary file not shown.

View file

@ -30,7 +30,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();
@ -52,8 +52,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() {
@ -217,15 +218,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) {