Added Status Check

This commit is contained in:
AlexE030
2023-06-16 10:02:57 +02:00
parent cff384f5b4
commit e436e61041
10 changed files with 186313 additions and 22 deletions
+17 -8
View File
@@ -43,8 +43,9 @@ export default function CalenderView(p) {
function readEntries() {
let url = baseURL + "/entries?semesterid=" + localStorage.getItem("currentsid") +
"&daynumber=" + currentWeekStartDay + "&yearnumber=" + currentYear + "&sessionid=" + localStorage.getItem("sessionid");
let currentsid = localStorage.getItem("currentsid")
let userid = localStorage.getItem("userid")
// let currentsid = localStorage.getItem("currentsid")
// let userid = localStorage.getItem("userid")
let moduleid = localStorage.getItem("moduleid");
try {
fetch(url).then(r => r.json()).then(en => {
@@ -55,7 +56,8 @@ export default function CalenderView(p) {
let maxLunchBreak = 0
let daySum = 0
for (let j = 0; j < en[i].length; j++) {
if (en[i][j] != null && currentsid == (en[i][j]).semesterid) {
// if (en[i][j] != null && currentsid == (en[i][j]).semesterid) {
if (en[i][j] != null && moduleid == (en[i][j]).moduleid) {
let elem = en[i][j]
if ((elem.timestart - 1) / 4 < 8) {
@@ -80,7 +82,8 @@ export default function CalenderView(p) {
let min = 24 * 3
for (let j2 = 0; j2 < en[i].length; j2++) {
if (en[i][j2] != null && (en[i][j2].timestart - 1) / 4 >= 11 && (en[i][j2].timestart - 1) / 4 <= 14 && currentsid == (en[i][j2]).semesterid) {
// if (en[i][j2] != null && (en[i][j2].timestart - 1) / 4 >= 11 && (en[i][j2].timestart - 1) / 4 <= 14 && currentsid == (en[i][j2]).semesterid) {
if (en[i][j2] != null && (en[i][j2].timestart - 1) / 4 >= 11 && (en[i][j2].timestart - 1) / 4 <= 14 && moduleid == (en[i][j2]).moduleid) {
if (en[i][j2].timestart < min && en[i][j2].timestart >= elem.timeend) {
min = en[i][j2].timestart
}
@@ -111,10 +114,12 @@ export default function CalenderView(p) {
for (let k = 0; k < 20; k++) {
if (en[i][k] != null){
if (en[i][k].semesterid != currentsid)
// if (en[i][k].semesterid != currentsid)
if (en[i][k].moduleid != moduleid)
{
for (let l = 0; l < 20; l++) {
if (en[i][l] != null && en[i][l].usercreatedbyid != userid) {
// if (en[i][l] != null && en[i][l].usercreatedbyid != userid) {
if (en[i][l] != null && en[i][l].moduleid != moduleid) {
if (en[i][l].timestart <= en[i][k].timestart && en[i][l].timeend >= en[i][k].timeend) {
en[i][k] = null;
break
@@ -128,9 +133,11 @@ export default function CalenderView(p) {
}
}
}
if (en[i][k] != null && en[i][k].usercreatedbyid != userid) {
// if (en[i][k] != null && en[i][k].usercreatedbyid != userid) {
if (en[i][k] != null && en[i][k].moduleid != moduleid) {
for (let l = 0; l < 20; l++) {
if (en[i][l] != null && en[i][l].semesterid != currentsid) {
// if (en[i][l] != null && en[i][l].semesterid != currentsid) {
if (en[i][l] != null && en[i][l].moduleid != moduleid) {
if (en[i][l].timestart <= en[i][k].timestart && en[i][l].timeend >= en[i][k].timeend) {
en[i][k] = null;
break
@@ -171,6 +178,7 @@ export default function CalenderView(p) {
"usercreatedbyid": localStorage.getItem("userid"),
"timestart": row,
"timeend": row + 3,
"moduleid": localStorage.getItem("moduleid"),
"info": localStorage.getItem("currentmodulename")
}
fetch(url, {
@@ -236,6 +244,7 @@ export default function CalenderView(p) {
"yearnumber": 0,
"semesterid": 0,
"usercreatedbyid": 0,
"moduleid": 0,
"timestart": selectedElement.timestart,
"timeend": selectedElement.timeend,
"info": ""