46 lines
1.2 KiB
TypeScript
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;
|
|
}
|
|
} |