// Progress.jsx — panel "Mi progreso": calificaciones + insignias. window.Progress function notaStrP(score, total) { if (score === null || score === undefined) return '—'; return ((Math.round((score / total) * 100) / 10).toFixed(1)).replace('.', ','); } const BADGE_GLYPH = { bolt: '⚡', star: '★', check: '✓', flame: '🔥', trophy: '🏆' }; function Progress({ user, onBack }) { const S = window.CourseStore; const units = S.units(); const pr = S.getProgress(); const earned = S.earnedBadges(); const done = S.unitsCompletedCount(); const pct = Math.round((done / units.length) * 100); // nota media de finales superados const finals = units.map(u => pr[u.slug].final).filter(f => f.passed && f.best != null); const media = finals.length ? (finals.reduce((s, f) => s + (f.best / S.FINAL.N) * 10, 0) / finals.length) : null; return (

Mi progreso

{user.name} · Matemáticas 4º ESO

{/* resumen */}
{[ { k: 'Curso completado', v: pct + '%' }, { k: 'Unidades superadas', v: done + ' / ' + units.length }, { k: 'Nota media (finales)', v: media === null ? '—' : media.toFixed(1).replace('.', ',') }, ].map(c => (
{c.v}
{c.k}
))}
{/* insignias */}

Insignias

{S.BADGES.map(b => { const has = !!earned[b.id]; return (
{BADGE_GLYPH[b.icon] || '★'}
{b.title}
{b.desc}
); })}
{/* calificaciones por unidad */}

Calificaciones

{['Unidad', 'P1', 'P2', 'P3', 'P4', 'Final'].map(h =>
{h}
)}
{units.map(u => { const up = pr[u.slug]; return (
{u.ud} {u.topic}
{[1, 2, 3, 4].map(n => (
{notaStrP(up.parts[n].best, S.PARTIAL.N)}
))}
{notaStrP(up.final.best, S.FINAL.N)}
); })}
); } window.Progress = Progress;