refactor(variants): drop unused isWinner flag on variant results

Each variant emitted isWinner:false and the calculator set winner.isWinner
=true, but the UI marks the winner via variantId===winnerId, never the
flag. Only one test read it. Removed from the 6 variant returns, the empty
result, and the calculator.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Kenearos 2026-07-07 11:45:15 +02:00
parent cb46e8fb04
commit 88cc0553f6
3 changed files with 9 additions and 19 deletions

View file

@ -64,8 +64,6 @@ class BonusCalculator {
winner = r;
}
}
winner.isWinner = true;
return {
classified,
isVacation,
@ -94,14 +92,13 @@ class BonusCalculator {
threshold: null,
deduction: { fr: 0, sa: 0, so: 0, weekday: 0 },
paidShares: { fr: 0, sa: 0, so: 0, weekday: 0 },
bonus: 0,
isWinner: false
bonus: 0
};
return {
classified: { fr: 0, sa: 0, so: 0, weekday: 0 },
isVacation,
winner: { ...empty, isWinner: true },
allResults: [1, 2, 3].map(variantId => ({ ...empty, variantId, isWinner: variantId === 1 })),
winner: { ...empty },
allResults: [1, 2, 3].map(variantId => ({ ...empty, variantId })),
totalBonus: 0
};
}

View file

@ -844,7 +844,6 @@ runner.test('Winner: klarer Sieger mit weekdays + 1 Fr', (t) => {
{ date: new Date('2025-11-04T12:00:00'), share: 1.0 } // Di
];
const result = calc.calculateMonthlyBonus(duties, false);
t.assertTrue(result.winner.isWinner, 'winner.isWinner=true');
t.assertEqual(result.allResults.length, 3, '3 Varianten im allResults');
t.assertTrue(result.totalBonus > 0, 'Bonus > 0');
});

View file

@ -52,8 +52,7 @@ function variant1(classified, isVacation) {
threshold: { frSo: frSoThreshold, weekday: weekdayThreshold },
deduction: { fr: 0, sa: 0, so: 0, weekday: 0 },
paidShares: { fr: 0, sa: 0, so: 0, weekday: 0 },
bonus: 0,
isWinner: false
bonus: 0
};
}
@ -83,8 +82,7 @@ function variant1(classified, isVacation) {
threshold: { frSo: frSoThreshold, weekday: weekdayThreshold },
deduction,
paidShares,
bonus,
isWinner: false
bonus
};
}
@ -104,8 +102,7 @@ function variant2(classified, isVacation) {
threshold: { sa: saThreshold, weekday: weekdayThreshold },
deduction: { fr: 0, sa: 0, so: 0, weekday: 0 },
paidShares: { fr: 0, sa: 0, so: 0, weekday: 0 },
bonus: 0,
isWinner: false
bonus: 0
};
}
@ -127,8 +124,7 @@ function variant2(classified, isVacation) {
threshold: { sa: saThreshold, weekday: weekdayThreshold },
deduction,
paidShares,
bonus,
isWinner: false
bonus
};
}
@ -146,8 +142,7 @@ function variant3(classified, isVacation) {
threshold: { pool: poolThreshold },
deduction: { fr: 0, sa: 0, so: 0, weekday: 0 },
paidShares: { fr: 0, sa: 0, so: 0, weekday: 0 },
bonus: 0,
isWinner: false
bonus: 0
};
}
@ -177,8 +172,7 @@ function variant3(classified, isVacation) {
threshold: { pool: poolThreshold },
deduction,
paidShares,
bonus,
isWinner: false
bonus
};
}