From 3a2c02d97f20388863f302b7ebb266f05b37794e Mon Sep 17 00:00:00 2001 From: Andreas Hubel Date: Mon, 23 Sep 2019 09:52:14 +0200 Subject: Schedule: skip duplicate events in fahrplan.xml input --- model/Schedule.php | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/model/Schedule.php b/model/Schedule.php index 712ecf8..d006d1f 100644 --- a/model/Schedule.php +++ b/model/Schedule.php @@ -138,6 +138,7 @@ class Schedule foreach($rooms as $roomName) { $roomidx++; + $laststart = false; $lastend = false; if($this->isRoomFiltered($roomName)) @@ -187,6 +188,10 @@ class Schedule $duration = $this->strToDuration((string)$event->duration); $end = $start + $duration; + // skip duplicate events in fahrplan source + if ( $laststart == $start ) + continue; + if($lastend && $lastend < $start) { // synthesize pause event @@ -219,11 +224,11 @@ class Schedule ); } - $personnames = array(); - if(isset($event->persons)) foreach($event->persons->person as $person) - $personnames[] = (string)$person; + $personnames = array(); + if(isset($event->persons)) foreach($event->persons->person as $person) + $personnames[] = (string)$person; - $program[$roomName][] = array( + $program[$roomName][] = array( 'title' => (string)$event->title, 'speaker' => implode(', ', $personnames), @@ -237,6 +242,7 @@ class Schedule 'optout' => $this->isOptout($event), ); + $laststart = $start; $lastend = $end; } -- cgit v1.2.3