fix issues
This commit is contained in:
@@ -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', () => {
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user