diff --git a/App/teacher.html b/App/teacher.html index adb33d9..65ac75e 100644 --- a/App/teacher.html +++ b/App/teacher.html @@ -2372,8 +2372,13 @@ async function ivOpenStudent(sid){ // === ÜBERSICHT === // Lehrer-Übersicht: Stat-Bar + aktive Aufgaben + Top-Performer + Aktivitäts-Sparkline + Modul-Cards. // Drei parallele API-Calls (matrix + activity-week + assignments) — alle existing. -// === Schuljahr-Datumsfilter für die Modul-Sektion === +// === Schuljahr-Datumsfilter für die Modul-Sektion (global, persistent) === var _modFilter = { from: null, to: null }; +try { + var _mfStored = JSON.parse(localStorage.getItem('ggs-mod-filter') || 'null'); + if (_mfStored && _mfStored.from && _mfStored.to) { _modFilter.from = _mfStored.from; _modFilter.to = _mfStored.to; } +} catch (e) {} +function saveModFilter() { try { localStorage.setItem('ggs-mod-filter', JSON.stringify(_modFilter)); } catch (e) {} } function ggsTodayStr() { var d = new Date(); return d.getFullYear() + '-' + String(d.getMonth()+1).padStart(2,'0') + '-' + String(d.getDate()).padStart(2,'0'); @@ -2482,10 +2487,7 @@ function renderModulesSection(modStats) { html += ''; return html; } -async function applyModFilter() { - var f = document.getElementById('mf-from'), t = document.getElementById('mf-to'); - if (f && f.value) _modFilter.from = f.value; - if (t && t.value) _modFilter.to = t.value; +async function refreshModulesSection() { var host = document.getElementById('ov-modules'); if (!host) return; host.style.opacity = '.5'; var ms = await api('results?class_id=' + currentClassId + '&view=mod_stats&from=' + _modFilter.from + '&to=' + _modFilter.to); @@ -2493,11 +2495,32 @@ async function applyModFilter() { host.style.opacity = ''; host.innerHTML = renderModulesSection(ms); } +async function applyModFilter() { + var f = document.getElementById('mf-from'), t = document.getElementById('mf-to'); + if (f && f.value) _modFilter.from = f.value; + if (t && t.value) _modFilter.to = t.value; + saveModFilter(); + await refreshModulesSection(); +} function resetModFilter() { _modFilter.from = ggsSchoolYearStart(); _modFilter.to = ggsTodayStr(); + saveModFilter(); applyModFilter(); } +// Vom Modul-Detail-Modal aus den globalen Zeitraum ändern +function setModDate(which, val) { + if (!val) return; + _modFilter[which] = val; saveModFilter(); + if (_modDetail && _modDetail.moduleId) openModuleDetail(_modDetail.moduleId); + refreshModulesSection(); +} +function resetModDateModal() { + _modFilter.from = ggsSchoolYearStart(); + _modFilter.to = ggsTodayStr(); saveModFilter(); + if (_modDetail && _modDetail.moduleId) openModuleDetail(_modDetail.moduleId); + refreshModulesSection(); +} // Avatar-Bild oder Emoji, gegebene Pixelgröße function ivTodayAvatar(emoji, px) { @@ -3683,9 +3706,13 @@ function renderModDetail() { var html = '
'; html += ''+d.module.icon+''; html += '

'+esc(d.module.name)+'

'; - function dmy(s){ if(!s) return ''; var p=s.split('-'); return p[2]+'.'+p[1]+'.'+p[0].slice(2); } - var zeit = (d.from && d.to) ? ' · '+dmy(d.from)+'–'+dmy(d.to)+'' : ''; - html += '
Klasse: '+d.classStats.totalPlays+' Durchgänge · '+totalH+'h Spielzeit · Ø '+(d.classStats.avgStars||'–')+'★ · '+d.classStats.studentsActive+'/'+d.classStats.studentsTotal+' aktiv'+zeit+'
'; + html += '
Klasse: '+d.classStats.totalPlays+' Durchgänge · '+totalH+'h Spielzeit · Ø '+(d.classStats.avgStars||'–')+'★ · '+d.classStats.studentsActive+'/'+d.classStats.studentsTotal+' aktiv
'; + var mfFrom = d.from || _modFilter.from || '', mfTo = d.to || _modFilter.to || ''; + html += '
Zeitraum: ' + + '' + + '– ' + + '
'; + html += ''; var hl = d.highlights || []; var champs = d.champions || {};