fix issues

This commit is contained in:
2025-12-26 11:49:20 +01:00
parent d08ec10b40
commit 68ae9da22a
44 changed files with 505 additions and 179 deletions

View File

@@ -16,12 +16,26 @@ export class RacesPageViewModel {
constructor(dto: RacesPageDTO) {
this.races = dto.races.map((r) => {
const status = (r as any).status as string | undefined;
const isUpcoming =
(r as any).isUpcoming ??
(status === 'upcoming' || status === 'scheduled');
const isLive =
(r as any).isLive ??
(status === 'live' || status === 'running');
const isPast =
(r as any).isPast ??
(status === 'completed' || status === 'finished' || status === 'cancelled');
const normalized: RaceListItemDTO = {
...r,
...(r as any),
strengthOfField: (r as any).strengthOfField ?? null,
isUpcoming: r.isUpcoming,
isLive: r.isLive,
isPast: r.isPast,
isUpcoming: Boolean(isUpcoming),
isLive: Boolean(isLive),
isPast: Boolean(isPast),
};
return new RaceListItemViewModel(normalized);