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;
for (int i = 0; i < duration - 1; i++) {
if (minuteData[i] != null) {
if (minuteData[i].getCo2Level() < minuteData[i + 1].getCo2Level()) {
breakPoints--;
}
if (minuteData[i].getCo2Level() < minuteData[i + 1].getCo2Level()) {
breakPoints--;
}
}
@ -202,61 +200,65 @@ public class App {
// #region main
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...");
initializeTeachers();
for (int roomIndex = 0; roomIndex < ROOM_NUMBERS.length; roomIndex++) {
TimeTable timeTable = new TimeTable(roomIndex);
for (int roomIndex = 0; roomIndex < ROOM_NUMBERS.length; roomIndex++) {
TimeTable timeTable = new TimeTable(roomIndex);
for (String date : DATES) {
try {
List<Co2Data> tempData = Co2Data.getData(generateLink(ROOM_NUMBERS[roomIndex], date));
if (tempData == null || tempData.isEmpty()) {
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 (String date : DATES) {
try {
List<Co2Data> tempData = Co2Data.getData(generateLink(ROOM_NUMBERS[roomIndex], date));
if (tempData == null || tempData.isEmpty()) {
System.out
.println("No data available for " + date + " in Room" + (roomIndex + 37) + ".");
continue;
}
}
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;
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);
}
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();
}
}