Naprawiono liczbę rozkładów dla scenerii

This commit is contained in:
2021-10-08 19:53:31 +02:00
parent 9bf1cb4735
commit f566d2e108
4 changed files with 18 additions and 15 deletions
+1 -1
View File
@@ -41,7 +41,7 @@
<span class="schedules">
<img :src="timetableIcon" alt="icon-timetable" />
<span v-if="stationInfo.scheduledTrains">
<span>
<span style="color: #eee">{{
stationInfo.scheduledTrains.length
}}</span>
@@ -18,7 +18,11 @@
<div
class="checkpoints"
v-if="stationInfo && stationInfo.online && stationInfo.checkpoints"
v-if="
stationInfo &&
stationInfo.scheduledTrains.length > 0 &&
stationInfo.checkpoints
"
>
<button
class="checkpoint_item btn--text"
@@ -31,9 +35,9 @@
</button>
</div>
<span class="timetable-item loading" v-if="dataStatus == 0">{{
$t("app.loading")
}}</span>
<span class="timetable-item loading" v-if="dataStatus == 0">
{{ $t("app.loading") }}
</span>
<span
class="timetable-item empty"
@@ -203,7 +207,7 @@ export default defineComponent({
methods: {
loadSelectedOption() {
if (!this.stationInfo) return;
if (!this.stationInfo.checkpoints) return;
if (this.stationInfo.checkpoints.length == 0) return;
if (this.selectedCheckpoint != "") return;
this.selectedCheckpoint = this.stationInfo.checkpoints[0].checkpointName;
+4 -7
View File
@@ -1,4 +1,3 @@
import Train from "./Train";
import ScheduledTrain from "./ScheduledTrain";
export default interface Station {
@@ -37,12 +36,10 @@ export default interface Station {
twoWay: { catenary: number; noCatenary: number };
};
checkpoints:
| {
checkpointName: string;
scheduledTrains: ScheduledTrain[];
}[]
| null;
checkpoints: {
checkpointName: string;
scheduledTrains: ScheduledTrain[];
}[];
stops: string[] | null;
+4 -2
View File
@@ -264,7 +264,7 @@ export const store = createStore<State>({
noCatenary: station[13] as number
}
},
checkpoints: station[14] ? (station[14] as string[]).map(sub => ({ checkpointName: sub, scheduledTrains: [] })) : null,
checkpoints: station[14] ? (station[14] as string[]).map(sub => ({ checkpointName: sub, scheduledTrains: [] })) : [],
stops: station[15] as string[],
default: station[16] as boolean,
@@ -385,9 +385,11 @@ export const store = createStore<State>({
if (stopName.includes(stationName) && !stop.stopName.includes("po.") && !stop.stopName.includes("podg.")) return true;
if (stationName.includes(stopName) && !stop.stopName.includes("po.") && !stop.stopName.includes("podg.")) return true;
if (stopName.includes("podg.") && stopName.split(", podg.")[0] && stationName.includes(stopName.split(", podg.")[0])) return true;
// if (stationName)
// if (station.stops && station.stops.includes(stop.stopNameRAW)) return true;
if (station.checkpoints.length > 0 && station.checkpoints.some(cp => cp.checkpointName.includes(stop.stopNameRAW))) return true;
return false;
});