Fix: alle heutigen Leistungen zaehlen (Ben) + Live-Session started_at bei Modulwechsel (Clara)

- live.php: ON DUPLICATE KEY UPDATE-Reihenfolge korrigiert (started_at VOR module_id), sonst
  wird der Modulwechsel nie erkannt -> Balken behielt alten Startzeitpunkt (Clara EU-Werkstatt seit 14:30).
- results.php view=today: liefert todayScores (Pro-Schueler-Aggregat aus student_results, zuverlaessig).
- teacher.html HEUTE-Triage: fertige Laeufe aus student_results + laufende aus Summary zusammengefuehrt;
  Totalversagen heute (<40) -> Foerdern. Ben (klima 36) erscheint jetzt korrekt in Foerdern.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-08-23 15:21:04 +02:00
parent cc83493055
commit f7bf0f0901
3 changed files with 54 additions and 13 deletions
+4 -1
View File
@@ -54,9 +54,12 @@ if ($method === 'POST') {
VALUES (?, ?, ?, ?, NOW(), NOW())
ON DUPLICATE KEY UPDATE
class_id = VALUES(class_id),
-- started_at ZUERST prüfen: MySQL wertet die Zuweisungen links→rechts
-- aus, daher muss dieser Check VOR module_id stehen, sonst ist
-- module_id schon der neue Wert und der Modulwechsel wird nie erkannt.
started_at = IF(module_id <> VALUES(module_id) OR last_seen < NOW() - INTERVAL 30 SECOND, NOW(), started_at),
module_id = VALUES(module_id),
state_json = VALUES(state_json),
started_at = IF(module_id <> VALUES(module_id) OR last_seen < NOW() - INTERVAL 30 SECOND, NOW(), started_at),
last_seen = NOW()',
[$studentId, $classId, $moduleId, $stateJson]
);