Merge branch 'main' of interstellardevelopment.org:sageTheDm/co2DataProject

This commit is contained in:
sageTheDM 2024-11-26 16:06:22 +01:00
commit 77f9faa0de
2 changed files with 16 additions and 5 deletions

Binary file not shown.

View file

@ -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);
}
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) {