view data fixes
This commit is contained in:
@@ -1,20 +1,19 @@
|
||||
import type { RaceStatsDTO } from '@/lib/types/generated/RaceStatsDTO';
|
||||
|
||||
/**
|
||||
* Race stats view model
|
||||
* Represents race statistics for display
|
||||
*/
|
||||
import { ViewModel } from "../contracts/view-models/ViewModel";
|
||||
import type { RaceStatsViewData } from "../view-data/RaceStatsViewData";
|
||||
|
||||
export class RaceStatsViewModel extends ViewModel {
|
||||
totalRaces: number;
|
||||
private readonly data: RaceStatsViewData;
|
||||
|
||||
constructor(dto: RaceStatsDTO) {
|
||||
this.totalRaces = dto.totalRaces;
|
||||
constructor(data: RaceStatsViewData) {
|
||||
super();
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
get totalRaces(): number { return this.data.totalRaces; }
|
||||
|
||||
/** UI-specific: Formatted total races */
|
||||
get formattedTotalRaces(): string {
|
||||
// Client-only formatting
|
||||
return this.totalRaces.toLocaleString();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user