diff options
| author | Florian Fischer <florian.fischer@muhq.space> | 2026-08-03 14:31:25 +0200 |
|---|---|---|
| committer | Florian Fischer <florian.fischer@muhq.space> | 2026-08-03 14:31:25 +0200 |
| commit | 6839831af54cd9302119bcc3bffafe10475958d4 (patch) | |
| tree | 12a1c1fbd864e9579cb9c3a09d4bf4686a280b73 /src/admin-tools.js | |
| parent | fccb70cbd876785f6833dfe6efc10ec9e445556d (diff) | |
| download | bycs-sol-6839831af54cd9302119bcc3bffafe10475958d4.tar.gz bycs-sol-6839831af54cd9302119bcc3bffafe10475958d4.zip | |
refactor project structure
* merge sites into single project root
* fix name of mass-graduation site
* enable typescript support
Diffstat (limited to 'src/admin-tools.js')
| -rw-r--r-- | src/admin-tools.js | 57 |
1 files changed, 57 insertions, 0 deletions
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(); +} |
