Skip to content
Snippets Groups Projects
Commit d298ebc5 authored by Niklas Schrötler's avatar Niklas Schrötler
Browse files

FahrplanPanel: Now filtering stops that are 5h in the future

This prevents key collisions
parent 780c74e7
No related branches found
No related tags found
No related merge requests found
...@@ -52,6 +52,11 @@ const FahrplanPanel = (props: {definition: FahrplanPanelDefinition}) => { ...@@ -52,6 +52,11 @@ const FahrplanPanel = (props: {definition: FahrplanPanelDefinition}) => {
const delay = stringToDelay(departure.delay); const delay = stringToDelay(departure.delay);
const arrival = processArrival(departure.sched_date, departure.time); const arrival = processArrival(departure.sched_date, departure.time);
// Throw away stops that are five hours in the future as keys start colliding at some point
if(arrival.getTime() >= 5 * 60 * 60 * 1000 + (new Date()).getTime()) {
continue;
}
if(existing_ind === -1) { if(existing_ind === -1) {
// If it does not exist, create a new route // If it does not exist, create a new route
newRoutes.push({ newRoutes.push({
...@@ -69,7 +74,7 @@ const FahrplanPanel = (props: {definition: FahrplanPanelDefinition}) => { ...@@ -69,7 +74,7 @@ const FahrplanPanel = (props: {definition: FahrplanPanelDefinition}) => {
countdown: parseInt(departure.countdown) countdown: parseInt(departure.countdown)
}) })
} else { } else {
// If it doesn't, just add a stop to the existing route // If it does, just add a stop to the existing route
newRoutes[existing_ind].stops.push({ newRoutes[existing_ind].stops.push({
name: departure.internal.stop, name: departure.internal.stop,
arrival, arrival,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment