From 888bff1972e18a7f32d55fcc23cd4900d03c7d61 Mon Sep 17 00:00:00 2001 From: MaZderMind Date: Sat, 12 May 2018 01:57:14 +0200 Subject: migrate logic to select current & upcoming talk into the Room class --- view/overview.php | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) (limited to 'view') diff --git a/view/overview.php b/view/overview.php index adc8d5f..e5032c4 100644 --- a/view/overview.php +++ b/view/overview.php @@ -2,19 +2,14 @@ $schedule = $conference->getSchedule(); -$talksPerRoom = $schedule->getSchedule(); $now = time() + $schedule->getSimulationOffset(); - -$upcomingTalksPerRoom = array_map(function($talks) use($now) { - return [ - 'current' => array_filter_last($talks, function($talk) use ($now) { - return $talk['start'] < $now && $talk['end'] > $now; - }), - 'next' => array_filter_first($talks, function($talk) use ($now) { - return !isset($talk['special']) && $talk['start'] > $now; - }), +$upcomingTalksPerRoom = []; +foreach ($conference->getRooms() as $room) { + $upcomingTalksPerRoom[$room->getSlug()] = [ + 'current' => $room->getCurrentTalk($now), + 'next' => $room->getNextTalk($now), ]; -}, $talksPerRoom); +}; echo $tpl->render(array( 'page' => 'overview', -- cgit v1.2.3 From 91a653392c0e66f1941036e2b17d8fa6b162cde0 Mon Sep 17 00:00:00 2001 From: MaZderMind Date: Sat, 12 May 2018 02:00:51 +0200 Subject: migrate logic for calculating schedule display time into schedule class --- view/overview.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'view') diff --git a/view/overview.php b/view/overview.php index e5032c4..fb9d15d 100644 --- a/view/overview.php +++ b/view/overview.php @@ -2,7 +2,7 @@ $schedule = $conference->getSchedule(); -$now = time() + $schedule->getSimulationOffset(); +$now = $schedule->getScheduleDisplayTime(); $upcomingTalksPerRoom = []; foreach ($conference->getRooms() as $room) { $upcomingTalksPerRoom[$room->getSlug()] = [ -- cgit v1.2.3 From 622b1f030c5c931704b7e997918dad2dcfd48551 Mon Sep 17 00:00:00 2001 From: MaZderMind Date: Sat, 12 May 2018 02:06:16 +0200 Subject: expose current & next talk in json-api --- view/streams-json-v2.php | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'view') diff --git a/view/streams-json-v2.php b/view/streams-json-v2.php index 114e73e..591e309 100644 --- a/view/streams-json-v2.php +++ b/view/streams-json-v2.php @@ -2,9 +2,11 @@ header('Content-Type: application/json'); +$basetime = time(); $struct = []; foreach (Conferences::getActiveConferences() as $conference) { + $now = $conference->getSchedule()->getScheduleDisplayTime($basetime); $overview = $conference->getOverview(); $groupstruct = array(); @@ -91,6 +93,10 @@ foreach (Conferences::getActiveConferences() as $conference) 'link' => forceslash(baseurl()).$room->getLink(), 'display' => $room->getDisplay(), 'stream' => $room->getStream(), + 'talks' => [ + 'current' => $room->getCurrentTalk($now), + 'next' => $room->getNextTalk($now), + ], 'streams' => $streams, ); } -- cgit v1.2.3