Empfehlung: 6. Karte 'Laeuft gut' in gleicher Form (volle Liste mit Balken) statt Kompakt-Streifen

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-08-23 15:05:08 +02:00
parent da1e6e6e87
commit be7d9fce1a
+9 -9
View File
@@ -2753,16 +2753,18 @@ var IV_ICON={
more:'<path d="M12 19V6"/><path d="m6 12 6-6 6 6"/><path d="M6 20h12"/>',
work:'<circle cx="12" cy="12" r="9"/><path d="m15 9-3.6 1.4L10 14l3.6-1.4L15 9Z"/>',
good:'<path d="m4 15 5-5 4 4 7-8"/><path d="M17 6h3v3"/>',
idle:'<circle cx="12" cy="12" r="9" stroke-dasharray="3 3"/><path d="M12 8v4l2 2"/>'};
idle:'<circle cx="12" cy="12" r="9" stroke-dasharray="3 3"/><path d="M12 8v4l2 2"/>',
calm:'<circle cx="12" cy="12" r="9"/><path d="m8.5 12.5 2.5 2.5 4.5-5"/>'};
var IV_META={support:['Fördern','zuletzt schwächere Läufe','--ivns'],more:['Fordern','zuletzt sicher, kaum gefordert','--ivnm'],
work:['Begleiten','zuletzt viel gearbeitet, wenig Ertrag','--ivnw'],good:['Bestätigen','zuletzt besser geworden','--ivngd'],idle:['Nicht aktiv','länger nicht mehr dran (oder noch nie)','--ivni']};
work:['Begleiten','zuletzt viel gearbeitet, wenig Ertrag','--ivnw'],good:['Bestätigen','zuletzt besser geworden','--ivngd'],
calm:['Läuft gut','solide unterwegs, keine Auffälligkeiten','--ivg'],idle:['Nicht aktiv','länger nicht mehr dran (oder noch nie)','--ivni']};
var IV_WEEK_CAP = 10800; // eine Woche zählt max. 3 h aktive Zeit (Ausreißer-Schutz)
// Rendert die 5 Triage-Karten (support/more/work/good/idle) aus fertigen Gruppen.
// Wiederverwendet für „HEUTE" und „insgesamt". todayMode passt Untertitel/Tooltips an.
function _ivTriageCards(groups, maxSec, todayMode){
var h='<div class="iv-grid">';
['support','more','work','good','idle'].forEach(function(key){
['support','more','work','good','calm','idle'].forEach(function(key){
var rows=groups[key], m=IV_META[key];
var sub=(todayMode && key==='idle')?'heute noch nicht dran':m[1];
h+='<div class="iv-card" style="--iva:var('+m[2]+')"><div class="iv-chead"><span class="iv-ic"><svg viewBox="0 0 24 24">'+IV_ICON[key]+'</svg></span><div class="iv-ct"><h4>'+m[0]+'</h4><p>'+sub+'</p></div><span class="iv-cn num">'+rows.length+'</span></div>';
@@ -2828,7 +2830,7 @@ function ivBuildOverview(cockpit, weeks, studentsCount, matrix, todaySummary){
var playsById={};
((matrix&&matrix.students)||[]).forEach(function(s){ playsById[s.id]=(matrix.totals[s.id]||{}).plays||0; });
var groups={support:[],more:[],work:[],good:[],idle:[]}, calm=[], erfSum=0,erfN=0, weekTotals=[];
var groups={support:[],more:[],work:[],good:[],calm:[],idle:[]}, erfSum=0,erfN=0, weekTotals=[];
cs.forEach(function(s){
var sid=s.studentId||s.id;
var recErf=(s.recentErfolg!=null)?s.recentErfolg:null; // Ø letzte 3 Läufe
@@ -2843,7 +2845,7 @@ function ivBuildOverview(cockpit, weeks, studentsCount, matrix, todaySummary){
weekTotals.push(secs);
var g=ivTriage(recErf, days, rplays, rising);
var row={sid:sid, name:s.displayName, erf:recErf, status:s.status, secs:secs, days:days};
if(g) groups[g].push(row); else calm.push(s.displayName);
if(g) groups[g].push(row); else groups.calm.push(row);
});
var erfAvg = erfN? Math.round(erfSum/erfN):null;
@@ -2894,7 +2896,7 @@ function ivBuildOverview(cockpit, weeks, studentsCount, matrix, todaySummary){
todayPlaysById[su.studentId]=sess.length;
todayErfById[su.studentId]= sco.length? Math.round(sco.reduce(function(a,b){return a+b;},0)/sco.length) : null;
});
var heuteGroups={support:[],more:[],work:[],good:[],idle:[]}, heuteCalm=[];
var heuteGroups={support:[],more:[],work:[],good:[],calm:[],idle:[]};
cs.forEach(function(s){
var sid=s.studentId||s.id;
var played=(todayPlaysById[sid]||0)>0;
@@ -2903,7 +2905,7 @@ function ivBuildOverview(cockpit, weeks, studentsCount, matrix, todaySummary){
while(secs2.length<10) secs2.unshift(0);
var g2 = !played ? 'idle' : ivTriage(tErf, 0, todayPlaysById[sid], false);
var row2={sid:sid, name:s.displayName, erf:played?tErf:null, status:s.status, secs:secs2, days:played?0:(s.daysSince!=null?s.daysSince:null)};
if(g2) heuteGroups[g2].push(row2); else heuteCalm.push(s.displayName);
if(g2) heuteGroups[g2].push(row2); else heuteGroups.calm.push(row2);
});
var heutePlayed=Object.keys(todayPlaysById).length;
var need=groups.support.length+groups.more.length+groups.work.length+groups.good.length+groups.idle.length;
@@ -2911,12 +2913,10 @@ function ivBuildOverview(cockpit, weeks, studentsCount, matrix, todaySummary){
// 1) HEUTE (oben) — genau dieselbe Darstellung, nur auf heute gefiltert
h+='<div class="iv-sec">Empfohlene Aktivität für dich — <b style="color:#2a5a2e">HEUTE</b><span>'+heutePlayed+' heute aktiv</span></div>';
h+=_ivTriageCards(heuteGroups, maxSec, true);
if(heuteCalm.length) h+='<div class="iv-calm"><span class="iv-dot"></span><span><b>Heute rund gelaufen — '+heuteCalm.length+'</b></span><span class="iv-names">'+heuteCalm.map(esc).join(' · ')+'</span></div>';
// 2) insgesamt (darunter) — der bisherige Allzeit-/Zuletzt-Blick
h+='<div class="iv-sec" style="margin-top:1.5rem">Empfohlene Aktivität für dich — insgesamt<span>'+need+' von '+studentsCount+'</span></div>';
h+=_ivTriageCards(groups, maxSec, false);
if(calm.length) h+='<div class="iv-calm"><span class="iv-dot"></span><span><b>Läuft rund — '+calm.length+'</b></span><span class="iv-names">'+calm.map(esc).join(' · ')+'</span></div>';
// Legende
h+='<div class="iv-legend">'
+'<div style="grid-column:1/-1;font-size:.72rem;color:#8a8a8a;margin-bottom:-.2rem">Die <b>Empfehlung</b> beruht nur auf der <b>aktuellen</b> Leistung: dem Erfolg der letzten Läufe und den Tagen seit dem letzten Mal. Der Verlauf daneben ist nur Historie.</div>'