Overlap Bugfix
If any entries overlaps with the Users entries from other Semesters, the users entries will be cut of
This commit is contained in:
@@ -43,6 +43,7 @@ export default function CalenderView(p) {
|
|||||||
let url = baseURL + "/entries?semesterid=" + localStorage.getItem("currentsid") +
|
let url = baseURL + "/entries?semesterid=" + localStorage.getItem("currentsid") +
|
||||||
"&daynumber=" + currentWeekStartDay + "&yearnumber=" + currentYear + "&sessionid=" + localStorage.getItem("sessionid");
|
"&daynumber=" + currentWeekStartDay + "&yearnumber=" + currentYear + "&sessionid=" + localStorage.getItem("sessionid");
|
||||||
let currentsid = localStorage.getItem("currentsid")
|
let currentsid = localStorage.getItem("currentsid")
|
||||||
|
let userid = localStorage.getItem("userid")
|
||||||
|
|
||||||
try {
|
try {
|
||||||
fetch(url).then(r => r.json()).then(en => {
|
fetch(url).then(r => r.json()).then(en => {
|
||||||
@@ -109,6 +110,42 @@ export default function CalenderView(p) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (let i = 0; i < 6; i++) {
|
||||||
|
for (let k = 0; k < 20; k++) {
|
||||||
|
if (en[i][k] != null){
|
||||||
|
|
||||||
|
if (en[i][k].semesterid != currentsid)
|
||||||
|
{
|
||||||
|
for (let l = 0; l < 20; l++) {
|
||||||
|
if (en[i][l] != null && en[i][l].usercreatedbyid != userid) {
|
||||||
|
if (en[i][l].timestart <= en[i][k].timestart && en[i][l].timeend >= en[i][k].timeend) {
|
||||||
|
en[i][k] = null;
|
||||||
|
break
|
||||||
|
}
|
||||||
|
if (en[i][k].timestart <= en[i][l].timeend && en[i][k].timestart >= en[i][l].timestart) {
|
||||||
|
en[i][k].timestart = en[i][l].timeend
|
||||||
|
}
|
||||||
|
if (en[i][k].timeend >= en[i][l].timestart && en[i][k].timeend <= en[i][l].timeend) {
|
||||||
|
en[i][k].timeend = en[i][l].timestart
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (en[i][k] != null && en[i][k].usercreatedbyid != userid) {
|
||||||
|
for (let l = 0; l < 20; l++) {
|
||||||
|
if (en[i][l] != null && en[i][l].semesterid != currentsid) {
|
||||||
|
if (en[i][l].timestart <= en[i][k].timestart && en[i][l].timeend >= en[i][k].timeend) {
|
||||||
|
en[i][k] = null;
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
let j = 0;
|
let j = 0;
|
||||||
for(let i = Math.round(((new Date(currentYear, 0, currentWeekStartDay) - new Date(currentYear, 0, 0)) / (1000 * 60 * 60 * 24))); i <= Math.round(((new Date(currentYear, 0, currentWeekStartDay + 5) - new Date(currentYear, 0, 0)) / (1000 * 60 * 60 * 24))); i++)
|
for(let i = Math.round(((new Date(currentYear, 0, currentWeekStartDay) - new Date(currentYear, 0, 0)) / (1000 * 60 * 60 * 24))); i <= Math.round(((new Date(currentYear, 0, currentWeekStartDay + 5) - new Date(currentYear, 0, 0)) / (1000 * 60 * 60 * 24))); i++)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,2 +1,2 @@
|
|||||||
// export const baseURL = "http://185.245.96.48:8080"
|
export const baseURL = "http://185.245.96.48:8080"
|
||||||
export const baseURL = "http://localhost:8080"
|
//export const baseURL = "http://localhost:8080"
|
||||||
Reference in New Issue
Block a user