diff --git a/src/components/SceneryView/SceneryTimetable.vue b/src/components/SceneryView/SceneryTimetable.vue index 908a4fa..c6d0788 100644 --- a/src/components/SceneryView/SceneryTimetable.vue +++ b/src/components/SceneryView/SceneryTimetable.vue @@ -213,9 +213,7 @@ export default defineComponent({ const mainStore = useMainStore(); const chosenCheckpoint = ref( - props.station?.generalInfo?.checkpoints?.length == 0 - ? '' - : props.station?.generalInfo?.checkpoints[0] ?? null + props.station?.generalInfo?.checkpoints[0] ?? props.station?.name ?? '' ); return { @@ -238,6 +236,8 @@ export default defineComponent({ if (!this.station) return []; if (!this.onlineScenery) return []; + console.log(this.onlineScenery.scheduledTrains, this.chosenCheckpoint); + return this.onlineScenery.scheduledTrains .filter( (ct) => diff --git a/src/store/mainStore.ts b/src/store/mainStore.ts index 5ad01a0..1ac3b12 100644 --- a/src/store/mainStore.ts +++ b/src/store/mainStore.ts @@ -239,8 +239,8 @@ export const useMainStore = defineStore('mainStore', { const station = this.stationList.find((s) => s.name === scenery.name); const checkpoints = [scenery.name]; - if (station?.generalInfo?.checkpoints) - checkpoints.push(...station.generalInfo.checkpoints.filter((cp) => cp != scenery.name)); + if (station?.generalInfo?.checkpoints && station.generalInfo.checkpoints.length > 0) + checkpoints.push(...station.generalInfo.checkpoints.filter((cp) => cp !== station.name)); scenery.stationTrains = sceneriesTrains.get(scenery.name)?.filter((sc) => sc.region == this.region.id) ?? []; @@ -320,7 +320,10 @@ export const useMainStore = defineStore('mainStore', { ...scenery, authors: scenery.authors?.split(',').map((a) => a.trim()), routes: routes, - checkpoints: scenery.checkpoints?.split(';') ?? [] + checkpoints: + scenery.checkpoints && scenery.checkpoints.trim().length > 0 + ? scenery.checkpoints.split(';') + : [] } }; });