feat: Quickstart, Benutzerverwaltung und Orion-Ergebnisbox

This commit is contained in:
Schubert Ferenc 2026-07-12 12:19:54 +02:00
parent 4f669a3426
commit e9e46f2cb4
404 changed files with 1032 additions and 600 deletions

View file

@ -90,6 +90,26 @@ def default_report_checklists(session: Session = Depends(get_session)) -> list[d
@router.get("/dashboard")
def dashboard(session: Session = Depends(get_session)) -> dict[str, int]:
today = func.current_date()
result_groups = {
"validation_result_open": ["OFFEN", "offen", None, ""],
"validation_result_passed": ["BESTANDEN", "bestanden"],
"validation_result_conditional": ["BESTANDEN_MIT_AUFLAGEN", "bestanden_mit_auflagen", "mit_auflagen", "bestanden mit Auflagen"],
"validation_result_failed": ["NICHT_BESTANDEN", "nicht_bestanden", "nicht bestanden"],
}
result_counts = {
key: session.scalar(select(func.count()).select_from(Validation).where(Validation.result.in_(values)))
or 0
for key, values in result_groups.items()
if None not in values
}
result_counts["validation_result_open"] = (
session.scalar(
select(func.count())
.select_from(Validation)
.where((Validation.result.in_(["OFFEN", "offen", ""])) | (Validation.result.is_(None)))
)
or 0
)
return {
"customers": session.scalar(select(func.count()).select_from(Customer)) or 0,
"locations": session.scalar(select(func.count()).select_from(Location)) or 0,
@ -137,6 +157,7 @@ def dashboard(session: Session = Depends(get_session)) -> dict[str, int]:
.where(Validation.next_validation_on < today)
)
or 0,
**result_counts,
}