wip
This commit is contained in:
@@ -17,6 +17,10 @@ export class PreviewLeagueScheduleUseCase {
|
||||
execute(params: PreviewLeagueScheduleQueryParams): void {
|
||||
const seasonSchedule = scheduleDTOToSeasonSchedule(params.schedule);
|
||||
|
||||
if (!seasonSchedule) {
|
||||
throw new Error('Invalid schedule data');
|
||||
}
|
||||
|
||||
const maxRounds =
|
||||
params.maxRounds && params.maxRounds > 0
|
||||
? Math.min(params.maxRounds, seasonSchedule.plannedRounds)
|
||||
@@ -46,8 +50,11 @@ export class PreviewLeagueScheduleUseCase {
|
||||
return 'No rounds scheduled.';
|
||||
}
|
||||
|
||||
const first = new Date(rounds[0].scheduledAt);
|
||||
const last = new Date(rounds[rounds.length - 1].scheduledAt);
|
||||
const firstRound = rounds[0]!;
|
||||
const lastRound = rounds[rounds.length - 1]!;
|
||||
|
||||
const first = new Date(firstRound.scheduledAt);
|
||||
const last = new Date(lastRound.scheduledAt);
|
||||
|
||||
const firstDate = first.toISOString().slice(0, 10);
|
||||
const lastDate = last.toISOString().slice(0, 10);
|
||||
|
||||
Reference in New Issue
Block a user