Per-Sim leistung_pct: alle 14 Sims senden das eine Leistungs-% (0-100)

Jede Sim liefert jetzt selbst leistung_pct in GGS_LIVE_STATE UND im Submit
(Fundament fuer das einheitliche %-System) — kein Rueckrechnen aus Sternen
mehr, keine 0-3-Sonderfaelle. Formeln je Sim wie vereinbart:
- klima/fluss/kofferdetektiv/heli: = vorhandener 0-100-score
- weltkueche: richtige/(richtige+falsche)*100 (Fehler in %)
- busfahrt/fluggesellschaft: topoPunkte/(Auftraege*3)*100
- farmer: gewichteter totalScore; energiemanager: ausgegl./gesamt -15/Blackout
- eu-werkstatt: firstTry/Schritte -5/Muelleimer; sonnensystem: Erstversuch-Quote
- tourismustal: Ziele+Zufriedenheit+Natur gewichtet; tourismusregion: gewichteter score
- logistik: Kontostand->% (sendet erstmals eine Kennzahl, auch an /api/assessment)
Teacher _leistungPct + live.php extractScore bevorzugen bereits diesen Wert.
Additive Aenderungen, bestehende Logik/Sterne unveraendert; alle 15 Dateien
syntaktisch geprueft.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-08-25 12:35:56 +02:00
parent 539f6b012e
commit 88e3c09e5c
15 changed files with 116 additions and 0 deletions
+11
View File
@@ -207,6 +207,12 @@ function onTileTap(c, r, pointerType) {
// stabile Schlüssel, didaktisch sinnvoll (Cockpit-Spalten).
window.GGS_LIVE_STATE = function () {
if (!state) return null;
const _goalsDone = state.scenario.goals.filter(g => g.check(state)).length;
const _goalsTotal = state.scenario.goals.length;
const _goalPct = _goalsTotal > 0 ? (_goalsDone / _goalsTotal) * 100 : 0;
const _leistung_pct = Math.max(0, Math.min(100, Math.round(
0.5 * _goalPct + 0.3 * (state.satisfaction || 0) + 0.2 * (state.nature || 0)
)));
return {
scene: state.scenario.id,
scenarioId: state.scenario.id, // Plattform-Konvention für Lektions-Gruppierung
@@ -228,6 +234,7 @@ window.GGS_LIVE_STATE = function () {
goalsTotal: state.scenario.goals.length,
questsDone: state.questIndex,
bottleneck: state.bottleneck,
leistung_pct: _leistung_pct,
};
};
@@ -252,6 +259,10 @@ function submitAssessment(completed) {
level: state.scenario.id,
stars,
score: Math.round((goals / total) * 100),
leistung_pct: Math.max(0, Math.min(100, Math.round(
0.5 * (total > 0 ? (goals / total) * 100 : 0)
+ 0.3 * (state.satisfaction || 0) + 0.2 * (state.nature || 0)
))),
duration_ms: Date.now() - (state._startedAt || Date.now()),
completed,
results: {