diff options
author | Andreas Hubel | 2019-09-23 09:52:14 +0200 |
---|---|---|
committer | Andreas Hubel | 2019-09-23 09:52:14 +0200 |
commit | 3a2c02d97f20388863f302b7ebb266f05b37794e (patch) | |
tree | 4ab65082912851b46d004d75f3fdf67481765de2 | |
parent | 636e3095c57a3ade83e48007b8d027a92f4f1911 (diff) |
Schedule: skip duplicate events in fahrplan.xml input
-rw-r--r-- | model/Schedule.php | 14 |
1 files 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; } |