From 6839831af54cd9302119bcc3bffafe10475958d4 Mon Sep 17 00:00:00 2001 From: Florian Fischer Date: Mon, 3 Aug 2026 14:31:25 +0200 Subject: refactor project structure * merge sites into single project root * fix name of mass-graduation site * enable typescript support --- src/admin-tools.js | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 src/admin-tools.js (limited to 'src/admin-tools.js') diff --git a/src/admin-tools.js b/src/admin-tools.js new file mode 100644 index 0000000..b0cf80d --- /dev/null +++ b/src/admin-tools.js @@ -0,0 +1,57 @@ +import { DB } from "./database.js"; +import { fetchStudents } from "./student-ENV.js"; + +let outputNode; +function output(msg) { + if (outputNode.style.display === "none") { + outputNode.style.display = "block"; + } + const line = document.createElement("div"); + line.innerHTML = msg; + line.classList.add("admin-tools-output-line"); + outputNode.appendChild(line); +} + +const studentsPromise = fetchStudents(); + +async function createGraduationDbs() { + const students = await studentsPromise; + + for (const student of students) { + if (!DB.getStudentDbs(student)) { + } + } +} + +async function init() { + outputNode = document.getElementById("admin-tools-output"); + const students = await studentsPromise; + + output("Suche nach Datenbanken ..."); + let missing = 0; + for (const student of students) { + const dbs = await DB.getStudentDbs(student); + if (!dbs) { + output(`\t${student.name}: Datenbanken fehlen`); + missing += 3; + continue; + } + for (const type of ["shadow", "public", "submit"]) { + if (!dbs[type]) { + output(`\t${student.name} ${student.group}: ${type} Datenbank fehlt`); + missing++; + } + } + } + if (missing) { + output(`${missing} von ${students.length * 3} Datenbanken fehlen!`); + } else { + output("Alle Datenbanken vorhanden!"); + } +} + +if (document.readyState === "loading") { + document.addEventListener("DOMContentLoaded", init); +} else { + init(); +} -- cgit v1.2.3