Pausenvalidierung

Alle 4h muss ein Dozent eine Pause von 15 min einlegen // alle 8h eine von 30 min
This commit is contained in:
AliGitGut
2023-06-21 20:00:17 +02:00
parent c979c3a801
commit d81922d188
3 changed files with 9148 additions and 0 deletions
+18
View File
@@ -9,6 +9,7 @@ import BasicDateCalendar from "@/components/CalendarSideBar";
import feiertagejs from "feiertagejs";
import PopUp from "@/components/PopUp";
import {useRouter} from "next/router";
import {info} from "autoprefixer";
let cellHeight = 20;
@@ -167,15 +168,32 @@ export default function CalenderView(p) {
if(localStorage.getItem("admin") == 0)
{
let entriesURL = baseURL + "/entries/all/module?sessionid=" + localStorage.getItem("sessionid") + "&moduleid=" + localStorage.getItem("moduleid")
fetch(entriesURL).then(r => r.json()).then(allEn => {
//console.log(allEn)
let moduleid = localStorage.getItem("moduleid")
let sum = 0
let checkTime = 0
for (let j = 0; j < allEn.length; j++) {
if (allEn[j] != null && allEn[j].moduleid == moduleid) {
sum += allEn[j].timeend - allEn[j].timestart
checkTime = (allEn[j].timeend - allEn[j].timestart)/3
if (checkTime >= 4){
sum -= 1
/* Pause Info geben?
console.log(allEn[j].info + " 15 Minuten Pause")
allEn[j].info = allEn[j].info + "15 Minuten Pause"
*/
}else if (checkTime >= 8){
sum -= 2
}else if (checkTime >= 12){
sum -= 3
}
}
}