Files
gridpilot.gg/apps/website/lib/view-models/RaceStewardingViewModel.ts
Marc Mintel 1b0a1f4aee
Some checks failed
Contract Testing / contract-tests (pull_request) Failing after 7m11s
Contract Testing / contract-snapshot (pull_request) Has been skipped
view data fixes
2026-01-24 23:29:55 +01:00

46 lines
1.2 KiB
TypeScript

import { ViewModel } from "../contracts/view-models/ViewModel";
import type { RaceStewardingViewData } from "../view-data/RaceStewardingViewData";
export class RaceStewardingViewModel extends ViewModel {
private readonly data: RaceStewardingViewData;
constructor(data: RaceStewardingViewData) {
super();
this.data = data;
}
get race() { return this.data.race; }
get league() { return this.data.league; }
get penalties() { return this.data.penalties; }
get driverMap() { return this.data.driverMap; }
/** UI-specific: Pending protests */
get pendingProtests() {
return this.data.pendingProtests;
}
/** UI-specific: Resolved protests */
get resolvedProtests() {
return this.data.resolvedProtests;
}
/** UI-specific: All protests */
get protests() {
return [...this.pendingProtests, ...this.resolvedProtests];
}
/** UI-specific: Total pending protests count */
get pendingCount(): number {
return this.data.pendingCount;
}
/** UI-specific: Total resolved protests count */
get resolvedCount(): number {
return this.data.resolvedCount;
}
/** UI-specific: Total penalties count */
get penaltiesCount(): number {
return this.penalties.length;
}
}