21 lines
605 B
TypeScript
21 lines
605 B
TypeScript
import { ViewModel } from "../contracts/view-models/ViewModel";
|
|
import type { LeagueScheduleViewData } from "../view-data/LeagueScheduleViewData";
|
|
import { LeagueScheduleRaceViewModel } from "./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;
|
|
}
|
|
}
|