don't take slots from other rooms that have nothing to do with us

This commit is contained in:
Vasil Kolev 2017-10-20 01:28:13 +03:00 committed by Openfest
parent 3e5047028f
commit ce7bbcbbbe
1 changed files with 14 additions and 7 deletions

View File

@ -24,6 +24,12 @@ function parseData($config, $data) {
$slots = [];
$timestamps = [];
$filtered_type_id =
array_key_exists('filterEventType', $config) &&
array_key_exists($config['filterEventType'], $config['eventTypes']) ?
$config['eventTypes'][$config['filterEventType']] :
null;
foreach ($data['halls'] as $hall_id => $hall) {
$slots[$hall_id] = [];
@ -32,6 +38,12 @@ function parseData($config, $data) {
continue;
}
$eid = $slot['event_id'];
$etype = $data['events'][$eid]['event_type_id'];
if ($etype !== $filtered_type_id) {
continue;
}
if (!in_array($slot['starts_at'], $timestamps)) {
$timestamps[] = $slot['starts_at'];
}
@ -42,8 +54,8 @@ function parseData($config, $data) {
$slots[$hall_id][$slot['starts_at']] = $slot;
}
ksort($slots[$hall_id]);
if (empty($slots[$hall_id])) unset($slots[$hall_id]);
}
sort($timestamps);
@ -71,11 +83,6 @@ function parseData($config, $data) {
// Fill in the event ID for each time slot in each hall
$events = [];
$filtered_type_id =
array_key_exists('filterEventType', $config) &&
array_key_exists($config['filterEventType'], $config['eventTypes']) ?
$config['eventTypes'][$config['filterEventType']] :
null;
foreach ($data['halls'] as $hall_id => $hall) {
$hall_data = [];