Cockpit: "Heute in der Klasse"-Zeile ganz oben in der Klassenuebersicht
Immer sichtbare Live-Zeile ueber den Empfehlungen: wie viele gerade aktiv + welche Sims, und wer JETZT Hilfe braucht (needsHelp) als klickbare Chips mit Klartext-Grund (z.B. "Ben - Trefferquote 10 %"). Quelle: cockpit.students. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -2627,6 +2627,23 @@ function ivZuletzt(days){
|
||||
return '<span class="iv-last'+(days>14?' iv-last-old':'')+'">'+t+'</span>';
|
||||
}
|
||||
|
||||
// Kurzer Klartext-Grund für „braucht Hilfe" in der Heute-Zeile (spiegelt _liveNeedsHelp).
|
||||
function _todayHelpReason(simId, st){
|
||||
st = st || {};
|
||||
switch(simId){
|
||||
case 'farmer':
|
||||
if (st.hit_rate!=null && st.hit_rate < 30) return 'Trefferquote '+st.hit_rate+' %';
|
||||
if (st.cash!=null && st.cash < 0) return 'Konto im Minus';
|
||||
return 'stockt';
|
||||
case 'weltkueche': return (st.mistakesInDish||0)+' Fehler im Gericht';
|
||||
case 'klima': case 'klima-3d': return 'Budget im Minus';
|
||||
case 'heli': return 'viele Fehlversuche';
|
||||
case 'logistik': return 'Konto im Minus';
|
||||
case 'eu-werkstatt': return 'viele Fehlversuche';
|
||||
case 'tourismustal': case 'tourismusregion': return 'Budget/Umwelt kritisch';
|
||||
}
|
||||
return 'stockt · braucht evtl. Hilfe';
|
||||
}
|
||||
function ivBuildOverview(cockpit, weeks, studentsCount, matrix){
|
||||
ivInjectCss();
|
||||
var cs = (cockpit && cockpit.students) || [];
|
||||
@@ -2668,6 +2685,24 @@ function ivBuildOverview(cockpit, weeks, studentsCount, matrix){
|
||||
|
||||
var h='<div class="iv-wrap">';
|
||||
h+='<div class="iv-h1">Klassenübersicht</div>';
|
||||
// „Heute in der Klasse" — Live-Zeile ganz oben: wer ist gerade dran, wer braucht JETZT Hilfe.
|
||||
var tActive = cs.filter(function(s){ return s.status==='aktiv' || s.status==='idle'; });
|
||||
var tHelp = tActive.filter(function(s){ return s.needsHelp; });
|
||||
var tSims={}; tActive.forEach(function(s){ if(s.activeSimName) tSims[s.activeSimName]=((s.activeSimIcon?s.activeSimIcon+' ':'')+s.activeSimName); });
|
||||
var tSimsStr = Object.keys(tSims).map(function(k){return tSims[k];}).join(' · ');
|
||||
h+='<div style="display:flex;flex-wrap:wrap;gap:.5rem 1.1rem;align-items:center;background:#f2f7f4;border:1px solid #cfe0d4;border-left:4px solid #3a6a3e;border-radius:10px;padding:.55rem .9rem;margin:0 0 1rem">';
|
||||
h+='<div style="font-size:.82rem;font-weight:800;color:#2a5a2e;white-space:nowrap"><span style="display:inline-block;width:8px;height:8px;border-radius:50%;background:#3a8a3e;margin-right:.4rem;'+(tActive.length?'animation:_pulse 1.5s infinite':'opacity:.4')+'"></span>Heute: '+tActive.length+' aktiv</div>';
|
||||
if(tSimsStr) h+='<div style="font-size:.74rem;color:#3a3a3a">'+esc(tSimsStr)+'</div>';
|
||||
if(tHelp.length){
|
||||
h+='<div style="display:flex;flex-wrap:wrap;gap:.35rem;flex:1 1 auto;justify-content:flex-end">';
|
||||
tHelp.forEach(function(s){
|
||||
h+='<button onclick="ivOpenStudent('+(s.studentId||s.id)+')" title="Details öffnen" style="cursor:pointer;background:#fdeae4;color:#b03a2a;border:1px solid #eabfb4;border-radius:999px;padding:.25rem .6rem;font-size:.72rem;font-weight:700;white-space:nowrap">🆘 '+esc(s.displayName)+' · '+esc((s.activeSimIcon?s.activeSimIcon+' ':'')+_todayHelpReason(s.activeSim, s.state))+'</button>';
|
||||
});
|
||||
h+='</div>';
|
||||
} else {
|
||||
h+='<div style="font-size:.74rem;color:#3a7a3e;flex:1 1 auto;text-align:right">✓ Niemand braucht gerade akut Hilfe</div>';
|
||||
}
|
||||
h+='</div>';
|
||||
// Stat-Karten
|
||||
h+='<div class="iv-stats">';
|
||||
h+='<div class="iv-stat"><span class="iv-lab">Erfolg Klassenschnitt</span><div class="iv-gfx"><span class="iv-ebar2"><i class="'+(erfAvg!=null?ivAmp(erfAvg):'')+'" style="width:'+(erfAvg||0)+'%"></i></span><span class="iv-bign num" style="font-size:1.05rem">'+(erfAvg!=null?erfAvg:'–')+'</span></div><span class="iv-exp">0 – 100, aus den letzten Läufen</span></div>';
|
||||
|
||||
Reference in New Issue
Block a user