fix: populate questions and options tables, scale AI chapters/checkpoints to video duration, open student lesson discovery

This commit is contained in:
Hamza-Ayed
2026-08-28 04:14:16 +03:00
parent dc2ebb108c
commit 17a22c6985
5 changed files with 75 additions and 57 deletions
+7 -9
View File
@@ -1073,8 +1073,10 @@ class StudentPortal
}
initWebSocket(token);
await checkStudentSession(token);
await loadStudentLessonsList();
}
// Always load lessons list and playback
await loadStudentLessonsList();
// Video player time listener for Socratic checkpoint
const video = document.getElementById('lesson_video_player');
@@ -1098,11 +1100,9 @@ class StudentPortal
async function loadStudentLessonsList() {
const token = localStorage.getItem('saqel_student_jwt');
if (!token) return;
try {
const res = await fetch('/api/student/lessons', {
headers: { 'Authorization': 'Bearer ' + token }
});
const headers = token ? { 'Authorization': 'Bearer ' + token } : {};
const res = await fetch('/api/student/lessons', { headers });
const data = await res.json();
if (res.ok && data.data && data.data.length > 0) {
const lessons = data.data;
@@ -1239,12 +1239,10 @@ class StudentPortal
async function loadStudentLessonPlayback(lessonId = 0) {
const token = localStorage.getItem('saqel_student_jwt');
if (!token) return;
try {
const targetUrl = lessonId > 0 ? `/api/lessons/${lessonId}/playback` : '/api/lessons/0/playback';
const res = await fetch(targetUrl, {
headers: { 'Authorization': 'Bearer ' + token }
});
const headers = token ? { 'Authorization': 'Bearer ' + token } : {};
const res = await fetch(targetUrl, { headers });
const data = await res.json();
if (res.ok && data.status === 'success') {
const les = data.data.lesson;