Files
gridpilot.gg/apps/website/lib/view-models/LeagueScheduleViewModel.ts
2026-01-26 17:47:37 +01:00

23 lines
646 B
TypeScript

import { ViewModel } from "../contracts/view-models/ViewModel";
import type { LeagueScheduleViewData } from "../view-data/LeagueScheduleViewData";
import { LeagueScheduleRaceViewModel } from "./LeagueScheduleRaceViewModel";
export { LeagueScheduleRaceViewModel };
export class LeagueScheduleViewModel extends ViewModel {
readonly races: LeagueScheduleRaceViewModel[];
constructor(data: LeagueScheduleViewData) {
super();
this.races = data.races.map((r: any) => new LeagueScheduleRaceViewModel(r));
}
get raceCount(): number {
return this.races.length;
}
get hasRaces(): boolean {
return this.raceCount > 0;
}
}