This commit is contained in:
2025-12-09 13:19:48 +01:00
parent a780139692
commit e34a11ae7c
3 changed files with 306 additions and 51 deletions

View File

@@ -354,15 +354,15 @@ class DIContainer {
// If protest was upheld, create a penalty
if (status === 'upheld') {
const penaltyTypes: Array<'time_penalty' | 'points_deduction' | 'warning'> = ['time_penalty', 'points_deduction', 'warning'];
const penaltyType = penaltyTypes[i % penaltyTypes.length];
// Alternate between points deduction and time penalties for visibility
const penaltyType = i % 2 === 0 ? 'points_deduction' : 'time_penalty';
const penalty = Penalty.create({
id: `penalty-${race.id}-${i}`,
raceId: race.id,
driverId: accusedResult.driverId,
type: penaltyType,
value: penaltyType === 'time_penalty' ? 5 : penaltyType === 'points_deduction' ? 3 : undefined,
value: penaltyType === 'points_deduction' ? 3 : 5,
reason: protest.incident.description,
protestId: protest.id,
issuedBy: primaryDriverId,
@@ -375,24 +375,48 @@ class DIContainer {
}
}
// Add a direct penalty (not from protest) for some races
if (raceIndex % 2 === 0 && raceResults.length > 5) {
const penalizedResult = raceResults[4];
if (penalizedResult) {
const penalty = Penalty.create({
id: `penalty-direct-${race.id}`,
raceId: race.id,
driverId: penalizedResult.driverId,
type: 'time_penalty',
value: 10,
reason: 'Track limits violation - gained lasting advantage',
issuedBy: primaryDriverId,
status: 'applied',
issuedAt: new Date(Date.now() - (raceIndex + 1) * 12 * 60 * 60 * 1000),
appliedAt: new Date(Date.now() - (raceIndex + 1) * 12 * 60 * 60 * 1000),
});
seededPenalties.push(penalty);
// Add direct penalties (not from protest) for better visibility in standings
if (raceResults.length > 5) {
// Add a points deduction penalty for some drivers
if (raceIndex % 3 === 0) {
const penalizedResult = raceResults[4];
if (penalizedResult) {
const penalty = Penalty.create({
id: `penalty-direct-${race.id}`,
raceId: race.id,
driverId: penalizedResult.driverId,
type: 'points_deduction',
value: 5,
reason: 'Causing avoidable collision',
issuedBy: primaryDriverId,
status: 'applied',
issuedAt: new Date(Date.now() - (raceIndex + 1) * 12 * 60 * 60 * 1000),
appliedAt: new Date(Date.now() - (raceIndex + 1) * 12 * 60 * 60 * 1000),
});
seededPenalties.push(penalty);
}
}
// Add another points deduction for different driver
if (raceIndex % 3 === 1 && raceResults.length > 6) {
const penalizedResult = raceResults[5];
if (penalizedResult) {
const penalty = Penalty.create({
id: `penalty-direct-2-${race.id}`,
raceId: race.id,
driverId: penalizedResult.driverId,
type: 'points_deduction',
value: 2,
reason: 'Track limits violation - gained lasting advantage',
issuedBy: primaryDriverId,
status: 'applied',
issuedAt: new Date(Date.now() - (raceIndex + 1) * 12 * 60 * 60 * 1000),
appliedAt: new Date(Date.now() - (raceIndex + 1) * 12 * 60 * 60 * 1000),
});
seededPenalties.push(penalty);
}
}
}
});