revert Fix for presantation issues that never happend occured
This commit is contained in:
Patrick 2024-12-02 20:00:02 +01:00
parent 092ca4522b
commit 0661e3ccbc
2 changed files with 52 additions and 50 deletions

Binary file not shown.

View file

@ -37,10 +37,8 @@ public class App {
int breakPoints = minuteData.length; int breakPoints = minuteData.length;
for (int i = 0; i < duration - 1; i++) { for (int i = 0; i < duration - 1; i++) {
if (minuteData[i] != null) { if (minuteData[i].getCo2Level() < minuteData[i + 1].getCo2Level()) {
if (minuteData[i].getCo2Level() < minuteData[i + 1].getCo2Level()) { breakPoints--;
breakPoints--;
}
} }
} }
@ -202,61 +200,65 @@ public class App {
// #region main // #region main
public static void main(String[] args) { public static void main(String[] args) {
try {
System.out.println("Calculations in process. Please do not shut off...");
initializeTeachers();
System.out.println("Calculations in process. Please do not shut off..."); for (int roomIndex = 0; roomIndex < ROOM_NUMBERS.length; roomIndex++) {
initializeTeachers(); TimeTable timeTable = new TimeTable(roomIndex);
for (int roomIndex = 0; roomIndex < ROOM_NUMBERS.length; roomIndex++) { for (String date : DATES) {
TimeTable timeTable = new TimeTable(roomIndex); try {
List<Co2Data> tempData = Co2Data.getData(generateLink(ROOM_NUMBERS[roomIndex], date));
for (String date : DATES) { if (tempData == null || tempData.isEmpty()) {
try { System.out
List<Co2Data> tempData = Co2Data.getData(generateLink(ROOM_NUMBERS[roomIndex], date)); .println("No data available for " + date + " in Room" + (roomIndex + 37) + ".");
if (tempData == null || tempData.isEmpty()) { continue;
System.out
.println("No data available for " + date + " in Room" + (roomIndex + 37) + ".");
continue;
}
Break[] shortBreaks = BreakSchedule.createBreaks(
BreakSchedule.START_SMALL_BREAK, BreakSchedule.END_SMALL_BREAK, tempData);
Break[] longBreaks = BreakSchedule.createBreaks(
BreakSchedule.START_LONG_BREAK, BreakSchedule.END_LONG_BREAK, tempData);
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) {
if (nextTeacher == null) {
nextTeacher = teacher;
}
calculateBreakPoints(shortBreaks[i], teacher, nextTeacher);
} }
}
for (int i = 0; i < longBreaks.length; i++) { Break[] shortBreaks = BreakSchedule.createBreaks(
Teacher teacher = findTeacherForBreak(i, timeTable, Arrays.asList(DATES).indexOf(date)); BreakSchedule.START_SMALL_BREAK, BreakSchedule.END_SMALL_BREAK, tempData);
Teacher nextTeacher = findTeacherForBreak(i + 1, timeTable,
Arrays.asList(DATES).indexOf(date)); Break[] longBreaks = BreakSchedule.createBreaks(
if (teacher != null) { BreakSchedule.START_LONG_BREAK, BreakSchedule.END_LONG_BREAK, tempData);
if (nextTeacher == null) {
nextTeacher = teacher; 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) {
if (nextTeacher == null) {
nextTeacher = teacher;
}
calculateBreakPoints(shortBreaks[i], teacher, nextTeacher);
} }
calculateBreakPoints(longBreaks[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) {
if (nextTeacher == null) {
nextTeacher = teacher;
}
calculateBreakPoints(longBreaks[i], teacher, nextTeacher);
}
}
} catch (MalformedURLException e) {
System.out.println("Error processing data for date: " + date + ". " + e);
} }
} catch (MalformedURLException e) {
System.out.println("Error processing data for date: " + date + ". " + e);
} }
} }
sortTeachers();
printTeachers(false);
interactWithUser();
} catch (Exception e) {
System.out.println("Fatal error: " + e.getMessage());
} finally {
scanner.close();
} }
sortTeachers();
printTeachers(false);
interactWithUser();
scanner.close();
} }
} }