From 0661e3ccbc1341538abadeef55cf4637c8a520ed Mon Sep 17 00:00:00 2001 From: Patrick_Pluto Date: Mon, 2 Dec 2024 20:00:02 +0100 Subject: [PATCH] revert 092ca4522b17b55b145db14153bf34f3263d26d1 revert Fix for presantation issues that never happend occured --- bin/App.class | Bin 10368 -> 10592 bytes src/App.java | 102 +++++++++++++++++++++++++------------------------- 2 files changed, 52 insertions(+), 50 deletions(-) diff --git a/bin/App.class b/bin/App.class index 6b9532736a6ef34e7adeac174b3fce8db9e74d98..473452102666f7d561139992b78f44189c640817 100644 GIT binary patch delta 1658 zcmZ8h2~d<}7=GSwfqz*S1Z3HT1z8Rk5m_KL1;r$iu+Y*pF-co&MFYVA@uG0boU$zO zv$7eFF;hp&N|`~kveX%yX(}D3GCMpvG@J0uJW{rYpPZ)lc)#<#p6C7EMPpBlvwhmR zdrvTkVpX`^wmf#2bjUeF&I)=x=5O-n)c9+waz@UZ7MR^Qv#!=I=doH~s|qxZ4m33Q zs{%2wVYCfVa>*`#==HHn?2fX36}8(@l5pKnmj9R=Kcl{GuD`M-per5ehB8#Rp{#nD z!zDJo$x#>-*+d&H`I`Vp5ya&?nynB1n@TwWQdzjb9~TGj1>$P#~}zs3`&udk~w@QA=Zshi?l;RWb{p@>0Y+qy)bYAHel?nHta z$X#?i5=AJX>fH>d6f-aib8ruy!o74_hSeC2Ej(?B z8V^cuOq48?OFkw^DISuEm@Ly#A#?DsEXEYk@XLBklMOL=RQ4bspJ2Ki;`}IP=qbrd z9W~6kmf6(7iO1m~78#hOZzk7f&g02^*s*}83(*VBh{F?1;7KH55xkg7RG&tFEY>SM zv!b6xIG$s+OX0@zNXH90CMA%xoV%@vBxVW3%0rye@d|NjB?GVNl_^sr))33Juwo6- zTDKx~*`U`6^9I7Yk*b^MdNTvtLYG^Sf;XwYjp}b>INl+C?_xafO+}mDmwGk3odNG+ z2=5^l?=y`LFaRHt-j9j-UQEJ1626}V?j^AY^y##P;YaBw5|AZr)#>HZvKbj=JJ6KX z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<{7srD?O#+l#Sy=I24;w38o!l+C8pWrk`!v aplNeWn-{ZgRiK8mQ0!V9p^8)qeE$Mxt2PY) diff --git a/src/App.java b/src/App.java index 4dcdccb..b112716 100644 --- a/src/App.java +++ b/src/App.java @@ -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 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 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(); } }