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

FahrplanPanel: Fixed keys of different lines colliding

parent 47e8773a
No related branches found
No related tags found
No related merge requests found
...@@ -5,7 +5,7 @@ import PanelTitle from "../../meta/PanelTitle"; ...@@ -5,7 +5,7 @@ import PanelTitle from "../../meta/PanelTitle";
import PanelContent from "../../meta/PanelContent"; import PanelContent from "../../meta/PanelContent";
import {StationResponse} from "./types/vrrfAPI"; import {StationResponse} from "./types/vrrfAPI";
import {Warning} from "@phosphor-icons/react"; import {Warning} from "@phosphor-icons/react";
import {AnimatePresence, motion} from 'framer-motion'; import {motion} from 'framer-motion';
export type FahrplanPanelDefinition = { export type FahrplanPanelDefinition = {
stops: string[], stops: string[],
...@@ -47,7 +47,7 @@ const FahrplanPanel = (props: {definition: FahrplanPanelDefinition}) => { ...@@ -47,7 +47,7 @@ const FahrplanPanel = (props: {definition: FahrplanPanelDefinition}) => {
} }
// Find existing route with same uid // Find existing route with same uid
const existing_ind = newRoutes.findIndex(r => r.uid === departure.key) const existing_ind = newRoutes.findIndex(r => r.uid === departure.key + "-" + departure.lineref.identifier)
// Pre-compute values that will be needed regardless // Pre-compute values that will be needed regardless
const delay = stringToDelay(departure.delay); const delay = stringToDelay(departure.delay);
...@@ -61,8 +61,8 @@ const FahrplanPanel = (props: {definition: FahrplanPanelDefinition}) => { ...@@ -61,8 +61,8 @@ const FahrplanPanel = (props: {definition: FahrplanPanelDefinition}) => {
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({
uid: departure.key, uid: departure.key + "-" + departure.lineref.identifier,
heading: departure.lineref.direction, heading: departure.destination,
identifier: departure.line, identifier: departure.line,
stops: [ stops: [
{ {
......
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