chore: checkpoints detection fix

This commit is contained in:
2024-05-19 23:42:06 +02:00
parent 7e75fa2516
commit 1a8da02ced
2 changed files with 9 additions and 6 deletions
+6 -3
View File
@@ -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(';')
: []
}
};
});