wip
This commit is contained in:
@@ -18,8 +18,8 @@ import {
|
||||
getResultRepository,
|
||||
getStandingRepository,
|
||||
getDriverRepository,
|
||||
getGetRaceWithSOFQuery,
|
||||
getGetRacePenaltiesQuery,
|
||||
getGetRaceWithSOFUseCase,
|
||||
getGetRacePenaltiesUseCase,
|
||||
} from '@/lib/di-container';
|
||||
|
||||
interface PenaltyData {
|
||||
@@ -52,7 +52,7 @@ export default function RaceResultsPage() {
|
||||
const leagueRepo = getLeagueRepository();
|
||||
const resultRepo = getResultRepository();
|
||||
const driverRepo = getDriverRepository();
|
||||
const raceWithSOFQuery = getGetRaceWithSOFQuery();
|
||||
const raceWithSOFUseCase = getGetRaceWithSOFUseCase();
|
||||
|
||||
const raceData = await raceRepo.findById(raceId);
|
||||
|
||||
@@ -64,10 +64,11 @@ export default function RaceResultsPage() {
|
||||
|
||||
setRace(raceData);
|
||||
|
||||
// Load race with SOF from application query
|
||||
const raceWithSOF = await raceWithSOFQuery.execute({ raceId });
|
||||
if (raceWithSOF) {
|
||||
setRaceSOF(raceWithSOF.strengthOfField);
|
||||
// Load race with SOF from application use case
|
||||
await raceWithSOFUseCase.execute({ raceId });
|
||||
const raceViewModel = raceWithSOFUseCase.presenter.getViewModel();
|
||||
if (raceViewModel) {
|
||||
setRaceSOF(raceViewModel.strengthOfField);
|
||||
}
|
||||
|
||||
// Load league data
|
||||
@@ -89,10 +90,11 @@ export default function RaceResultsPage() {
|
||||
|
||||
// Load penalties for this race
|
||||
try {
|
||||
const penaltiesQuery = getGetRacePenaltiesQuery();
|
||||
const penaltiesData = await penaltiesQuery.execute(raceId);
|
||||
const penaltiesUseCase = getGetRacePenaltiesUseCase();
|
||||
await penaltiesUseCase.execute(raceId);
|
||||
const penaltiesViewModel = penaltiesUseCase.presenter.getViewModel();
|
||||
// Map the DTO to the PenaltyData interface expected by ResultsTable
|
||||
setPenalties(penaltiesData.map(p => ({
|
||||
setPenalties(penaltiesViewModel.map(p => ({
|
||||
driverId: p.driverId,
|
||||
type: p.type,
|
||||
value: p.value,
|
||||
|
||||
Reference in New Issue
Block a user