student_id-FK-Migration Stufe 1+2: Name-Joins -> student_sessions.student_id

- student_sessions: neue Spalte student_id (+Index), backfilled aus (class_id,display_name)
- Session::createStudent setzt student_id (per Lookup, falls nicht uebergeben)
- alle Joins students<->student_sessions von display_name auf student_id umgestellt:
  Benchmark.php, live.php (5x), results.php (4x + runs), modules.php, profile.php, progress.php (answers+runs)
- verlustfrei verifiziert (alt-Join == neu-Join, class 99/102)

Robuster gegen Umbenennung/Doppelnamen, indexierbare Joins.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-08-15 19:16:41 +02:00
parent 2984d93e7e
commit fb44ec7afe
7 changed files with 42 additions and 30 deletions
+1 -2
View File
@@ -76,8 +76,7 @@ class Benchmark
"SELECT a.sim_id, a.results, a.process_log, a.submitted_at
FROM assessments a
JOIN student_sessions ss ON ss.id = a.session_id
JOIN students s ON s.class_id = ss.class_id AND s.display_name = ss.display_name
WHERE s.id = ? AND a.class_id = ?
WHERE ss.student_id = ? AND a.class_id = ?
ORDER BY a.sim_id, a.submitted_at DESC",
[$studentId, $classId]
);