diff --git a/App/teacher.html b/App/teacher.html index 5665675..53aab23 100644 --- a/App/teacher.html +++ b/App/teacher.html @@ -1375,39 +1375,46 @@ async function _renderInactiveToday(activeSet) { try { data = await api('live?summary=1&class_id=' + currentClassId + '&date=' + encodeURIComponent(today)); } catch(e){ return ''; } if (!data || data.error || !Array.isArray(data.students)) return ''; - var rows = []; + var groups = []; data.students.forEach(function(s){ if (activeSet && activeSet[s.studentId]) return; // gerade online → oben var sess = (s.sessions||[]).filter(function(x){ return x.startMs; }); if (!sess.length) return; // heute nichts gespielt if (sess.some(function(x){ return x.isLive || x.success==='running'; })) return; // läuft noch → oben - sess.sort(function(a,b){ return (b.endMs||0)-(a.endMs||0); }); - rows.push({ s:s, last:sess[0] }); + sess.sort(function(a,b){ return (a.startMs||0)-(b.startMs||0); }); // chronologisch + var lastEnd = 0; sess.forEach(function(x){ if((x.endMs||0)>lastEnd) lastEnd = x.endMs||0; }); + groups.push({ s:s, sess:sess, lastEnd:lastEnd }); }); - if (!rows.length) return ''; - rows.sort(function(a,b){ return (b.last.endMs||0)-(a.last.endMs||0); }); - var html = '
Heute nicht mehr aktiv · '+rows.length+'
'; - html += '

Heute schon gearbeitet, gerade aber offline — mit letzter Aktivität und deren Leistung.

'; + if (!groups.length) return ''; + groups.sort(function(a,b){ return b.lastEnd - a.lastEnd; }); // zuletzt aktive Person oben + var html = '
Heute bereits aktiv · '+groups.length+'
'; + html += '

Heute schon gearbeitet, gerade aber offline — alle Aktivitäten mit Uhrzeit und Leistung.

'; html += '
'; html += '' + '' + '' + '' + ''; - rows.forEach(function(r){ - var s=r.s, last=r.last; + groups.forEach(function(g){ + var s = g.s; var av = (typeof s.emoji === 'string' && s.emoji.indexOf('avatar:')===0) ? '' : ''+(s.emoji||'🧑‍🎓')+''; - var score = (last.score!=null)?last.score:(last.stars!=null?Math.round(last.stars/5*100):null); - var perf = score!=null - ? ''+score+' %' - : (last.success==='aborted' ? 'abgebrochen' : ''); - html += '' - + '' - + '' - + '' - + ''; + g.sess.forEach(function(last, j){ + var score = (last.score!=null)?last.score:(last.stars!=null?Math.round(last.stars/5*100):null); + var perf = score!=null + ? ''+score+' %' + : (last.success==='aborted' ? 'abgebrochen' : ''); + var nameCell = (j===0) + ? ''+av+''+esc(s.displayName)+'' + : ''; + var sep = (j===0) ? 'border-top:2px solid rgba(0,0,0,.07);' : ''; // neue Person → Trennlinie + html += '' + + '' + + '' + + '' + + ''; + }); }); html += '
Schüler*inZuletzt aktivAktivitätLeistung
'+av+''+esc(s.displayName)+''+_hhmm(last.endMs)+' Uhr'+esc((last.simIcon||'📚')+' '+(last.simTitle||last.simId))+(last.lessonLabel?' · '+esc(last.lessonLabel):'')+''+perf+'
'+nameCell+''+_hhmm(last.endMs)+' Uhr'+esc((last.simIcon||'📚')+' '+(last.simTitle||last.simId))+(last.lessonLabel?' · '+esc(last.lessonLabel):'')+''+perf+'
'; return html;