From e4535a9c7e6c6a50c90bd193fc4522b8de2c4708 Mon Sep 17 00:00:00 2001 From: flifloo Date: Wed, 20 Jan 2021 22:26:13 +0100 Subject: [PATCH] Finish teacher edt page --- public/javascripts/edt.js | 2 +- sockets/get/agendaGet.js | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/public/javascripts/edt.js b/public/javascripts/edt.js index ac50335..6144c49 100644 --- a/public/javascripts/edt.js +++ b/public/javascripts/edt.js @@ -85,4 +85,4 @@ document.querySelectorAll("td").forEach(td => { marksdetailsbackground.addEventListener("click", () => { details.classList.add("invisible"); marksdetailsbackground.classList.add("invisible"); -}) +}); diff --git a/sockets/get/agendaGet.js b/sockets/get/agendaGet.js index 5c5ba5f..41e77fb 100644 --- a/sockets/get/agendaGet.js +++ b/sockets/get/agendaGet.js @@ -21,7 +21,7 @@ module.exports = socket => { include: [ {model: models.User, attributes: ["email", "firstName", "lastName"]}, {model: models.Group, include: models.Semester}, - {model: models.Semester, include: models.Group} + {model: models.Semester, include: {model: models.Group, include: models.Semester}} ] }; @@ -48,6 +48,9 @@ module.exports = socket => { addWhere(options, 1, "id", g.id); } } + if (socket.request.session.user.permissions === 2) + if (data && !data.teachers) + data.teachers = [socket.request.session.user.email]; if (data && data.teachers) { for (let teacher of data.teachers) { let t = await models.User.findByPk(teacher);