Added Status Check
This commit is contained in:
@@ -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": ""
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
import {baseURL} from "@/components/Constants";
|
||||
|
||||
export default function HourCounter(){
|
||||
|
||||
function countTimePlanned(){
|
||||
const entryurl = baseURL + "/entries/planned?sessionid=" + localStorage.getItem("sessionid");
|
||||
const moduleid = localStorage.getItem("moduleid")
|
||||
let hoursPlanned = 0
|
||||
|
||||
fetch(entryurl).then(response => response.json()).then(entries => {
|
||||
entries.forEach(e => {
|
||||
hoursPlanned += e.timeend - e.timestart
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
console.log(20-countTimePlanned());
|
||||
|
||||
}
|
||||
@@ -1,7 +1,30 @@
|
||||
import React from "react"
|
||||
import React, {useState} from "react"
|
||||
import {baseURL} from "@/components/Constants";
|
||||
import {console} from "next/dist/compiled/@edge-runtime/primitives/console";
|
||||
|
||||
export default function StatusBar(p)
|
||||
{
|
||||
let testindex = 1;
|
||||
const modules = p.modules;
|
||||
|
||||
let url = baseURL + "/entries/planned?sessionid=" + localStorage.getItem("sessionid");
|
||||
|
||||
fetch(url).then(response => response.json()).then(e => {
|
||||
modules.forEach(modules => {
|
||||
e.forEach(e => {
|
||||
if (e.moduleid == modules.id){
|
||||
testindex = 2;
|
||||
if (modules.activated == 0){
|
||||
testindex = 3;
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
console.log(testindex);
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
if(p.progress > 100) p.progress = 100;
|
||||
let classNames = ["not-started", "started", "finished"];
|
||||
let index = p.progress / 50;
|
||||
|
||||
@@ -110,7 +110,7 @@ export default function SemesterOverview(p) {
|
||||
localStorage.setItem("currentsid", e.id)
|
||||
funcButtonEdit(e, m);
|
||||
}}/>
|
||||
<StatusBar progress={0}/>
|
||||
{/*<StatusBar progress={0}/>*/}
|
||||
<div style={
|
||||
{
|
||||
display:"flex",
|
||||
|
||||
@@ -67,7 +67,7 @@ export default function SemesteroverviewLecturer(p) {
|
||||
editable={false} text={semesterNames[index]} text2={e.name}
|
||||
onClick={(f) => onClickSemester(e, f)}
|
||||
/>
|
||||
<StatusBar progress={0}/>
|
||||
<StatusBar progress={0} modules={entries}/>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user