Studien-Semester-Select: parit\u00e4ts- und umfangsgerecht (WS ungerade, SS gerade; BSc 1-6, MSc 1-4) aus CIS-Endpoint

This commit is contained in:
Nicolas Gruber
2026-10-19 12:13:51 +02:00
parent d97164cddc
commit 567bcb40ee
7 changed files with 104 additions and 43 deletions
+13
View File
@@ -297,6 +297,19 @@ class CISClient:
matrikel=mail.split("@")[0] if "@" in mail else ""))
return out
# ---------- Studien-Semester pro StG ----------
@lru_cache(maxsize=64)
def study_semesters(self, kz: str) -> list[int]:
"""Von CIS bekannte Studien-Semester eines StG (z.B. [1..6] BSc, [1..4] MSc)."""
try:
r = self.s.post(f"{self.base}/private/lvplan/lvplan_autocomplete.php",
data={"autocomplete": "getSemester", "stg_kz": kz}, timeout=30)
data = r.json()
vals = data.values() if isinstance(data, dict) else data
return sorted({int(x) for x in vals if str(x).strip().isdigit()})
except Exception:
return []
# ---------- Verbände pro StG/Semester ----------
def verbands_for(self, kz: str, sem: str) -> list[str]:
fallback = ["V", "B", "G", "A", "C", "D", "E", "F"]