From 9b30e7f948135363235640e5d2b34f69ab0accef Mon Sep 17 00:00:00 2001 From: Frieder Hannenheim Date: Thu, 30 Jan 2025 12:30:30 +0100 Subject: [PATCH] =?UTF-8?q?add=20nix=20package=20&=20fill=20out=20studieng?= =?UTF-8?q?=C3=A4nge?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- flake.nix | 34 ++++++--- src/converter.py | 13 ++++ src/rechner.ts | 40 ++++++++-- src/studiengänge/ba_inf_2009.toml | 3 +- src/studiengänge/ba_minf_2009.toml | 101 ++++++++++++++++++++++++++ src/studiengänge/dip_inf_2010.toml | 41 +++++++++++ src/studiengänge/ma_inf_2010.toml | 41 +++++++++++ src/studiengänge/ma_minf_2010.toml | 29 ++++++++ src/studiengänge/vordip_inf_2010.toml | 73 +++++++++++++++++++ src/stylesheet.css | 6 +- 10 files changed, 364 insertions(+), 17 deletions(-) create mode 100644 src/converter.py create mode 100644 src/studiengänge/ba_minf_2009.toml create mode 100644 src/studiengänge/dip_inf_2010.toml create mode 100644 src/studiengänge/ma_inf_2010.toml create mode 100644 src/studiengänge/ma_minf_2010.toml create mode 100644 src/studiengänge/vordip_inf_2010.toml diff --git a/flake.nix b/flake.nix index c469a92..27a9715 100644 --- a/flake.nix +++ b/flake.nix @@ -6,18 +6,34 @@ outputs = { self, nixpkgs, utils }: utils.lib.eachDefaultSystem (system: let pkgs = nixpkgs.legacyPackages.${system}; + buildInputs = with pkgs; [ + just + toml2json + nodePackages.webpack-cli + entr + + typescript + typescript-language-server + ]; in { - devShell = pkgs.mkShell { - buildInputs = with pkgs; [ - just - toml2json - nodePackages.webpack-cli - entr + packages.default = pkgs.stdenv.mkDerivation { + name = "notenrechner"; + src = ./.; - typescript - typescript-language-server - ]; + inherit buildInputs; + + buildPhase = '' + just build + ''; + installPhase = '' + mkdir -p $out + cp dist/* $out/ + ''; + }; + + devShell = pkgs.mkShell { + inherit buildInputs; }; } ); diff --git a/src/converter.py b/src/converter.py new file mode 100644 index 0000000..3d6bae8 --- /dev/null +++ b/src/converter.py @@ -0,0 +1,13 @@ +import re +import sys + +input = sys.stdin.read() + +for line in input.splitlines(): + match = re.search(r'"(\w+)"\D*(\d+).*"(.*)"', line) + print(f"""\ +[[ma_minf_2009.module]] +short = "{match.group(1)}" +lp = {match.group(2)} +name = "{match.group(3)}"\ +""") diff --git a/src/rechner.ts b/src/rechner.ts index b4483f2..33c306e 100644 --- a/src/rechner.ts +++ b/src/rechner.ts @@ -18,11 +18,23 @@ import studiengaenge from '../build/studiengaenge.json' var select = document.getElementById("studiengaenge") as HTMLSelectElement; + for (let key in studiengaenge) { + let studiengang = studiengaenge[key as keyof typeof studiengaenge]; let option = document.createElement('option'); option.value = key; - option.text = String(studiengaenge[key as keyof typeof studiengaenge].display_name); - select.add(option); + option.text = String(studiengang.display_name); + + let optGroupId = "optgroup" + studiengang.type.toLowerCase(); + let optionGroup = document.getElementById(optGroupId) as HTMLOptGroupElement; + if (optionGroup == null) { + optionGroup = document.createElement("optgroup"); + optionGroup.id = optGroupId; + optionGroup.label = studiengang.type; + select.add(optionGroup); + } + + optionGroup.appendChild(option); } select.selectedIndex = 0; @@ -67,18 +79,32 @@ select.onchange = function changed() { label.textContent = modul.name; row.insertCell().appendChild(label); - row.insertCell().appendChild(input); + let input_cell = row.insertCell(); + input_cell.className = "noteninputcell"; + if (modul.lp != 0) { + input_cell.appendChild(input); + } else { + let hinweis = document.createElement('small'); + hinweis.innerText = "Keine Note.\n Muss bestanden sein." + input_cell.appendChild(hinweis); + } } - notenInner.appendChild(table); let submit = document.createElement('input'); submit.type = "submit"; submit.value = "Berechnen"; + let row = table.insertRow(); + row.insertCell(); + let cell = row.insertCell(); + cell.className = "noteninputcell"; + cell.appendChild(submit); + + notenInner.appendChild(table); + let result = document.createElement('p'); notenInner.appendChild(result); - notenInner.appendChild(submit); noten.onsubmit = function calculate(event) { event.preventDefault(); @@ -87,6 +113,10 @@ select.onchange = function changed() { for (let modulIndex in gewichtung.module) { let modul = gewichtung.module[modulIndex]; + if (modul.lp == 0) { + continue; + } + let noteInput = document.getElementById(modul.short + "input") as HTMLInputElement; let noteString = noteInput.value; let note = parseFloat(noteString.replace(",", ".")); diff --git a/src/studiengänge/ba_inf_2009.toml b/src/studiengänge/ba_inf_2009.toml index 1f3bbdb..1d946a6 100644 --- a/src/studiengänge/ba_inf_2009.toml +++ b/src/studiengänge/ba_inf_2009.toml @@ -1,5 +1,6 @@ [ba_inf_2009] display_name = "Abschlussnote Bachelor Informatik (PO 2009)" +type = "Bachelor" # Module aufgelistet mit Kürzel, LP, Modulname [[ba_inf_2009.module]] @@ -40,7 +41,7 @@ lp = 6 name = "Softwaretechnologie" [[ba_inf_2009.module]] short = "swtp" -lp = 6 +lp = 0 name = "Softwaretechnologie-Projekt" [[ba_inf_2009.module]] short = "dbrn" diff --git a/src/studiengänge/ba_minf_2009.toml b/src/studiengänge/ba_minf_2009.toml new file mode 100644 index 0000000..4036197 --- /dev/null +++ b/src/studiengänge/ba_minf_2009.toml @@ -0,0 +1,101 @@ +[ba_minf_2009] +display_name = "Abschlussnote Bachelor Medieninformatik (PO 2009)" +type = "Bachelor" + +[[ba_minf_2009.module]] +short = "mathe1" +lp = 15 +name = "Einführung in die Mathematik für Informatiker" +[[ba_minf_2009.module]] +short = "mathe2" +lp = 15 +name = "Mathematische Methoden für Informatiker" +[[ba_minf_2009.module]] +short = "aud" +lp = 6 +name = "Algorithmen und Datenstrukturen" +[[ba_minf_2009.module]] +short = "prog" +lp = 6 +name = "Programmierung" +[[ba_minf_2009.module]] +short = "lab" +lp = 4 +name = "Einführungspraktikum" +[[ba_minf_2009.module]] +short = "swt" +lp = 6 +name = "Softwaretechnologie" +[[ba_minf_2009.module]] +short = "swtp" +lp = 0 +name = "Softwaretechnologie-Projekt" +[[ba_minf_2009.module]] +short = "bus" +lp = 7 +name = "Betriebssysteme und Sicherheit" +[[ba_minf_2009.module]] +short = "dbrn" +lp = 10 +name = "Datenbanken und Rechnernetze" +[[ba_minf_2009.module]] +short = "ikt" +lp = 5 +name = "Informations- und Kodierungstheorie" +[[ba_minf_2009.module]] +short = "fs" +lp = 8 +name = "Formale Systeme" +[[ba_minf_2009.module]] +short = "gdg" +lp = 4 +name = "Grundlagen der Gestaltung" +[[ba_minf_2009.module]] +short = "emg" +lp = 4 +name = "Einführung in die Mediengestaltung" +[[ba_minf_2009.module]] +short = "ra" +lp = 10 +name = "Rechnerarchitektur" +[[ba_minf_2009.module]] +short = "mums" +lp = 5 +name = "Medien und Medienströme" +[[ba_minf_2009.module]] +short = "emi" +lp = 5 +name = "Einführung in die Medieninformatik" +[[ba_minf_2009.module]] +short = "ecg" +lp = 5 +name = "Einführung in die Computergrafik" +[[ba_minf_2009.module]] +short = "medida" +lp = 3 +name = "Medienpsychologie und -didaktik" +[[ba_minf_2009.module]] +short = "wme" +lp = 5 +name = "Web- und Multimedia Engineering" +[[ba_minf_2009.module]] +short = "komp" +lp = 0 +name = "Komplexpraktikum" +[[ba_minf_2009.module]] +short = "vert1" +lp = 12 +name = "Vertiefung" +[[ba_minf_2009.module]] +short = "vert2" +lp = 12 +name = "Vertiefung zur Bachelor-Arbeit" +[[ba_minf_2009.module]] +short = "aqua" +lp = 5 +name = "Allgemeine Qualifikationen" +[[ba_minf_2009.module]] +short = "bachelor" +lp = 52 +name = "Bachelor-Arbeit und Kolloquium" + diff --git a/src/studiengänge/dip_inf_2010.toml b/src/studiengänge/dip_inf_2010.toml new file mode 100644 index 0000000..428ac74 --- /dev/null +++ b/src/studiengänge/dip_inf_2010.toml @@ -0,0 +1,41 @@ +[dip_inf_2010] +display_name = "Abschlussnote Diplom Informatik (PO 2010)" +type = "Diplom" + +[[dip_inf_2010.module]] +short = "bas1" +lp = 12 +name = "Basismodul 1" +[[dip_inf_2010.module]] +short = "bas2" +lp = 12 +name = "Basismodul 2" +[[dip_inf_2010.module]] +short = "bas3" +lp = 12 +name = "Basismodul 3" +[[dip_inf_2010.module]] +short = "vert" +lp = 15 +name = "Vertiefungsmodul" +[[dip_inf_2010.module]] +short = "profil" +lp = 12 +name = "Profilmodul 2" +[[dip_inf_2010.module]] +short = "beleg" +lp = 9 +name = "Großer Beleg" +[[dip_inf_2010.module]] +short = "aqua" +lp = 5 +name = "Berufsspezifische Schlüsselkompetenzen" +[[dip_inf_2010.module]] +short = "vnf" +lp = 15 +name = "Vertiefung im Nebenfach" +[[dip_inf_2010.module]] +short = "diplom" +lp = 60 +name = "Diplomarbeit und Verteidigung" + diff --git a/src/studiengänge/ma_inf_2010.toml b/src/studiengänge/ma_inf_2010.toml new file mode 100644 index 0000000..1ddfd17 --- /dev/null +++ b/src/studiengänge/ma_inf_2010.toml @@ -0,0 +1,41 @@ +[ma_inf_2010] +display_name = "Abschlussnote Master Informatik (PO 2010)" +type = "Master" + +[[ma_inf_2010.module]] +short = "bas1" +lp = 12 +name = "Basismodul 1" +[[ma_inf_2010.module]] +short = "bas2" +lp = 12 +name = "Basismodul 2" +[[ma_inf_2010.module]] +short = "bas3" +lp = 12 +name = "Basismodul 3" +[[ma_inf_2010.module]] +short = "vert" +lp = 15 +name = "Vertiefungsmodul" +[[ma_inf_2010.module]] +short = "profil1" +lp = 0 +name = "Profilmodul 1" +[[ma_inf_2010.module]] +short = "profil2" +lp = 12 +name = "Profilmodul 2" +[[ma_inf_2010.module]] +short = "praktikum" +lp = 12 +name = "Vertieftes Master-Praktikum" +[[ma_inf_2010.module]] +short = "aqua" +lp = 6 +name = "Allgemeine Qualifikation" +[[ma_inf_2010.module]] +short = "master" +lp = 60 +name = "Master-Arbeit und Verteidigung" + diff --git a/src/studiengänge/ma_minf_2010.toml b/src/studiengänge/ma_minf_2010.toml new file mode 100644 index 0000000..4929b2e --- /dev/null +++ b/src/studiengänge/ma_minf_2010.toml @@ -0,0 +1,29 @@ +[ma_minf_2010] +display_name = "Abschlussnote Master Medieninformatik (PO 2010)" +type = "Master" + +[[ma_minf_2010.module]] +short = "bruecke" +lp = 12 +name = "Brückenmodul" +[[ma_minf_2010.module]] +short = "profil" +lp = 0 +name = "Profilmodul 1" +[[ma_minf_2010.module]] +short = "vert" +lp = 60 +name = "Vertiefungsmodule" +[[ma_minf_2010.module]] +short = "ergaenzung" +lp = 12 +name = "Ergänzungsmodule" +[[ma_minf_2010.module]] +short = "aqua" +lp = 6 +name = "Allgemeine Qualifikation" +[[ma_minf_2010.module]] +short = "master" +lp = 60 +name = "Master-Arbeit und Verteidigung" + diff --git a/src/studiengänge/vordip_inf_2010.toml b/src/studiengänge/vordip_inf_2010.toml new file mode 100644 index 0000000..c1814e6 --- /dev/null +++ b/src/studiengänge/vordip_inf_2010.toml @@ -0,0 +1,73 @@ +[vordip_inf_2010] +display_name = "Vordiplomnote Diplom Informatik (PO 2010)" +type = "Diplom" + +[[vordip_inf_2010.module]] +short = "mathe1" +lp = 12 +name = "Einführung in die Mathematik für Informatiker" +[[vordip_inf_2010.module]] +short = "mathe2" +lp = 12 +name = "Mathematische Methoden für Informatiker" +[[vordip_inf_2010.module]] +short = "aud" +lp = 5 +name = "Algorithmen und Datenstrukturen" +[[vordip_inf_2010.module]] +short = "prog" +lp = 5 +name = "Programmierung" +[[vordip_inf_2010.module]] +short = "lab" +lp = 4 +name = "Einführungs- und Programmierpraktikum" +[[vordip_inf_2010.module]] +short = "swt" +lp = 5 +name = "Softwaretechnologie" +[[vordip_inf_2010.module]] +short = "bus" +lp = 7 +name = "Betriebssysteme und Sicherheit" +[[vordip_inf_2010.module]] +short = "dbrn" +lp = 9 +name = "Datenbanken und Rechnernetze" +[[vordip_inf_2010.module]] +short = "ikt" +lp = 4 +name = "Informations- und Kodierungstheorie" +[[vordip_inf_2010.module]] +short = "fs" +lp = 8 +name = "Formale Systeme" +[[vordip_inf_2010.module]] +short = "logik" +lp = 8 +name = "Theoretische Informatik und Logik" +[[vordip_inf_2010.module]] +short = "is" +lp = 4 +name = "Intelligente Systeme" +[[vordip_inf_2010.module]] +short = "ra" +lp = 10 +name = "Rechnerarchitektur" +[[vordip_inf_2010.module]] +short = "tg" +lp = 9 +name = "Technische Grundlagen und Hardwarepraktikum" +[[vordip_inf_2010.module]] +short = "soi" +lp = 4 +name = "Systemorientierte Informatik / Hardware Software-Codesign" +[[vordip_inf_2010.module]] +short = "nf" +lp = 7 +name = "Nebenfach" +[[vordip_inf_2010.module]] +short = "aqua" +lp = 5 +name = "Allgemeine Basisqualifikationen" + diff --git a/src/stylesheet.css b/src/stylesheet.css index 9d31087..2664904 100644 --- a/src/stylesheet.css +++ b/src/stylesheet.css @@ -58,6 +58,10 @@ th, td { padding: 4px; } +.noteninputcell { + text-align: center; +} + input { outline: none; padding: 4px; @@ -74,9 +78,7 @@ input:focus { } input[type=submit] { - align-self: end; width: 82px; - margin-right: 4px; box-sizing: border-box; }