Etappe 2: Cockpit progressiv + Check-In + Paarung + Lehrer-Dashboard

Cockpit (V1, progressives Layout):
- /cockpit zeigt nur Karten, die zum Status passen.
  Onboarding-Karte nur fuer Neue; Paarungs-Karte immer wenn aktiv;
  Drucker-Buchung erst nach L1 fertig.
- Banner-System: ungelesene Lehrer-Notizen, offene Rueckfragen,
  eingegangene Paarungs-Anfragen.

Check-In (V3 + E-021):
- Modal beim ersten Cockpit-Aufruf eines Besuchstages.
- "Ich arbeite weiter" als Default-Ein-Klick-Option.
- Freitext optional.
- POST /cockpit/check-in mit UNIQUE-Constraint pro Tag.

Onboarding-Status (E-019):
- /cockpit/lektion/<nr>/status (selbst-zertifiziert).
- profil_lektion_status-Tabelle, ON CONFLICT-Upsert.

Paarung (E-002):
- profil_anfrage-Tabelle on-demand.
- Anfrage stellen / annehmen / ablehnen / aufloesen.
- Konflikt-Check (keine Doppel-Paarungen).
- Banner im Cockpit des Adressaten.

Lehrer-Dashboard (V5, docs/lehrer-dashboard.md):
- /admin/dashboard mit 4 Sektionen (Wer ist heute hier / Wartet auf
  Review / Drucker-Status / Wer haengt fest) + Schnell-Zahlen + offene
  Rueckfragen.
- "Notiz hinterlassen"-Quick-Action via lehrer_notiz-Tabelle.
- Live-Drucker-Status kommt mit Etappe 5 (aktuell nur DB-Stand).

Daten-Helper getrennt:
- services/cockpit_status.py: Bundle fuer progressives Cockpit
- services/dashboard_status.py: 4-Sektionen-Queries

Vorgezogen aus Etappe 3:
- /lektionen + /lektion/<nr> Minimal-Renderer mit Markdown
- 3 Onboarding-Lektionen als Seeds (Platzhalter-Text fuer Markus)

Smoke-Test bestanden: Login als neuer SuS -> Onboarding ->
Check-In -> L1 fertig -> Paarung mit zweitem SuS -> Admin-Dashboard
-> Lehrer-Notiz -> Banner im Cockpit.
This commit is contained in:
2026-05-24 19:13:19 +02:00
parent fae86c64c0
commit abf96ca8f2
14 changed files with 1228 additions and 45 deletions

View File

@@ -238,7 +238,44 @@ def profile_karten():
@bp.route("/dashboard")
@admin_required
def dashboard():
abort(501) # Etappe 2
"""Drill-Down-Dashboard (V5). Siehe docs/lehrer-dashboard.md."""
from services.dashboard_status import (
wer_ist_heute_hier,
wartet_auf_review,
offene_rueckfragen,
drucker_status_alle,
wer_haengt_fest,
dashboard_zahlen,
)
return render_template(
"admin_dashboard.html",
heute=wer_ist_heute_hier(),
review=wartet_auf_review(),
rueckfragen=offene_rueckfragen(),
drucker=drucker_status_alle(),
haengen_fest=wer_haengt_fest(),
zahlen=dashboard_zahlen(),
)
@bp.route("/profil/<int:profil_id>/notiz", methods=["POST"])
@admin_required
def profil_notiz(profil_id):
"""V5-Quick-Action: Lehrer hinterlaesst Notiz im SuS-Cockpit."""
text = (request.form.get("text") or "").strip()
typ = (request.form.get("typ") or "info").strip()
if not text:
flash("Notiz darf nicht leer sein.", "error")
return redirect(url_for("admin.dashboard"))
conn = get_db()
conn.execute(
"INSERT INTO lehrer_notiz (profil_id, text, typ) VALUES (?, ?, ?)",
(profil_id, text, typ)
)
conn.commit()
conn.close()
flash("Notiz hinterlegt — wird im SuS-Cockpit angezeigt.", "success")
return redirect(url_for("admin.dashboard"))
@bp.route("/lektionen")