fix issues

This commit is contained in:
2026-01-02 00:21:24 +01:00
parent 79913bb45e
commit 8693dde21e
46 changed files with 1680 additions and 302 deletions

View File

@@ -396,7 +396,7 @@ describe('AdminTrustRatingCalculator', () => {
];
const delta = AdminTrustRatingCalculator.calculateTotalDelta(voteInputs, systemInputs);
expect(delta.value).toBe(8); // 15 (vote) + 5 (SLA) + (-10) (reversal) = 10
expect(delta.value).toBe(10); // 15 (vote) + 5 (SLA) + (-10) (reversal) = 10
});
it('should handle empty inputs', () => {

View File

@@ -596,8 +596,12 @@ export class RatingEventFactory {
startPosition: number,
fieldStrength: number
): number {
// Handle edge cases where data might be inconsistent
// If totalDrivers is less than position, use position as totalDrivers for calculation
const effectiveTotalDrivers = Math.max(totalDrivers, position);
// Base score from position (reverse percentile)
const positionScore = ((totalDrivers - position + 1) / totalDrivers) * 100;
const positionScore = ((effectiveTotalDrivers - position + 1) / effectiveTotalDrivers) * 100;
// Bonus for positions gained
const positionsGained = startPosition - position;