From 9f3ff7b34560a4301a134be21611ba0d37d73ef7 Mon Sep 17 00:00:00 2001 From: Daniel Bulant Date: Sun, 24 Oct 2021 14:26:21 +0200 Subject: [PATCH] =?UTF-8?q?zobrazen=C3=AD=20jak=C3=A9=20p=C5=99edm=C4=9Bty?= =?UTF-8?q?=20u=C4=8Ditel=20u=C4=8D=C3=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- commands/ssps/profil.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/commands/ssps/profil.js b/commands/ssps/profil.js index 6541e3d..59ba837 100644 --- a/commands/ssps/profil.js +++ b/commands/ssps/profil.js @@ -5,6 +5,8 @@ const Person = require("../../utils/models/person"); const api = require("../../utils/api"); const Teacher = require("../../utils/models/teacher"); const Student = require("../../utils/models/student"); +const sequelize = require("../../utils/sequelize"); +const Subject = require("../../utils/models/subject"); module.exports = class profil extends commando.Command { constructor(client) { @@ -47,6 +49,14 @@ module.exports = class profil extends commando.Command { embed.addField("Zkratka", teacher.abbrev, true); if(teacher.roomId) embed.addField("Místnost", teacher.roomId, true); if(teacher.komise) embed.addField("Komise", teacher.komise, true); + const subjects = await Subject.findAll({ + where: sequelize.where(sequelize.literal("(SELECT 1 FROM prestiz.timetables WHERE subjectId=subject.id AND teacherId = $teacher LIMIT 1)"), 1), + attributes: ["abbrev"], + bind: { + teacher: teacher.id + } + }); + embed.addField("Učí", subjects.map(t => t.abbrev).join(", ") || "Neučí žádné předměty"); } else if(person.type === "student") { const student = await Student.findOne({ where: { personId: person.id }