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 -1
View File
@@ -74,7 +74,7 @@ if ($method === 'GET') {
// Individuelle Overrides für diesen Schüler
$studentRow = $db->fetchOne(
'SELECT s.id FROM students s JOIN student_sessions ss ON ss.class_id = s.class_id AND ss.display_name = s.display_name WHERE ss.id = ?',
'SELECT student_id AS id FROM student_sessions WHERE id = ?',
[$sessionId]
);
$overrides = [];