Skip to content

Commit

Permalink
Fix Chamonix schedule
Browse files Browse the repository at this point in the history
  • Loading branch information
nicoSWD committed Jul 13, 2024
1 parent 444320d commit 06a9a55
Showing 1 changed file with 32 additions and 1 deletion.
33 changes: 32 additions & 1 deletion src/Domain/Calendar/PostProcess/Season2024PostProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
private const int OLYMPIC_QUALIFIERS_BUDAPEST_ID = 1385;
private const string OLYMPIC_QUALIFIERS_BUDAPEST_LIVE_STREAM = 'https://olympics.com/en/sport-events/olympic-qualifier-series-2024-budapest/broadcasting-schedule';

private const int CHAMONIX_IFSC_EVENT_ID = 1357;

public function __construct(
private IFSCRoundFactory $roundFactory,
private IFSCScheduleFactory $scheduleFactory,
Expand All @@ -46,6 +48,8 @@ public function process(array $events): array
$event->rounds = $this->fetchOlympicQualifiersShanghaiRounds($event);
} elseif ($this->isOlympicQualifiersBudapest($event)) {
$event->rounds = $this->fetchOlympicQualifiersBudapestRounds($event);
} elseif ($this->isChamonixEvent($event)) {
$event->rounds = $this->fetchChamonixRounds($event);
}
}

Expand All @@ -67,6 +71,11 @@ private function isOlympicQualifiersBudapest(IFSCEvent $event): bool
return $event->eventId === self::OLYMPIC_QUALIFIERS_BUDAPEST_ID;
}

private function isChamonixEvent(IFSCEvent $event): bool
{
return $event->eventId === self::CHAMONIX_IFSC_EVENT_ID;
}

private function fetchOlympicQualifiersShanghaiRounds(IFSCEvent $event): array
{
$eventInfo = IFSCEventInfo::fromEvent($event);
Expand Down Expand Up @@ -119,6 +128,23 @@ private function fetchOlympicQualifiersBudapestRounds(IFSCEvent $event): array
];
}

/** @return IFSCRound[] */
private function fetchChamonixRounds(IFSCEvent $event): array
{
$eventInfo = IFSCEventInfo::fromEvent($event);

return [
// 13/07
$this->chamonixRound($eventInfo, "Men's & Women's Lead Qualification", '2024-07-13T09:00:00+02:00'),
$this->chamonixRound($eventInfo, "Men's & Women's Speed Qualification", '2024-07-13T18:45:00+02:00', 'https://youtu.be/X-jMhtf_svQ'),
$this->chamonixRound($eventInfo, "Men's & Women's Speed Final", '2024-07-13T20:55:00+02:00', 'https://youtu.be/EZkv2RIQe94'),

// 14/07
$this->chamonixRound($eventInfo, "Men's & Women's Lead Semi-Final", '2024-07-14T10:00:00+02:00', 'https://youtu.be/K7T8E2_cCB0'),
$this->chamonixRound($eventInfo, "Men's & Women's Lead Final", '2024-07-14T20:30:00+02:00', 'https://youtu.be/UVp79oxI4Uc'),
];
}

private function shanghaiRound(IFSCEventInfo $eventInfo, string $title, string $startsAt): IFSCRound
{
return $this->round($eventInfo, $title, $startsAt, 'Asia/Shanghai', self::OLYMPIC_QUALIFIERS_SHANGHAI_LIVE_STREAM);
Expand All @@ -129,7 +155,12 @@ private function budapestRound(IFSCEventInfo $eventInfo, string $title, string $
return $this->round($eventInfo, $title, $startsAt, 'Europe/Budapest', self::OLYMPIC_QUALIFIERS_BUDAPEST_LIVE_STREAM);
}

private function round(IFSCEventInfo $eventInfo, string $title, string $startsAt, string $timeZone, string $streamUrl): IFSCRound
private function chamonixRound(IFSCEventInfo $eventInfo, string $title, string $startsAt, ?string $streamUrl = null): IFSCRound
{
return $this->round($eventInfo, $title, $startsAt, 'Europe/Paris', $streamUrl);
}

private function round(IFSCEventInfo $eventInfo, string $title, string $startsAt, string $timeZone, ?string $streamUrl): IFSCRound
{
$schedule = $this->scheduleFactory->create(
name: $title,
Expand Down

0 comments on commit 06a9a55

Please sign in to comment.