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"> <span class="schedules">
<img :src="timetableIcon" alt="icon-timetable" /> <img :src="timetableIcon" alt="icon-timetable" />
<span v-if="stationInfo.scheduledTrains"> <span>
<span style="color: #eee">{{ <span style="color: #eee">{{
stationInfo.scheduledTrains.length stationInfo.scheduledTrains.length
}}</span> }}</span>
@@ -18,7 +18,11 @@
<div <div
class="checkpoints" class="checkpoints"
v-if="stationInfo && stationInfo.online && stationInfo.checkpoints" v-if="
stationInfo &&
stationInfo.scheduledTrains.length > 0 &&
stationInfo.checkpoints
"
> >
<button <button
class="checkpoint_item btn--text" class="checkpoint_item btn--text"
@@ -31,9 +35,9 @@
</button> </button>
</div> </div>
<span class="timetable-item loading" v-if="dataStatus == 0">{{ <span class="timetable-item loading" v-if="dataStatus == 0">
$t("app.loading") {{ $t("app.loading") }}
}}</span> </span>
<span <span
class="timetable-item empty" class="timetable-item empty"
@@ -203,7 +207,7 @@ export default defineComponent({
methods: { methods: {
loadSelectedOption() { loadSelectedOption() {
if (!this.stationInfo) return; if (!this.stationInfo) return;
if (!this.stationInfo.checkpoints) return; if (this.stationInfo.checkpoints.length == 0) return;
if (this.selectedCheckpoint != "") return; if (this.selectedCheckpoint != "") return;
this.selectedCheckpoint = this.stationInfo.checkpoints[0].checkpointName; this.selectedCheckpoint = this.stationInfo.checkpoints[0].checkpointName;
+4 -7
View File
@@ -1,4 +1,3 @@
import Train from "./Train";
import ScheduledTrain from "./ScheduledTrain"; import ScheduledTrain from "./ScheduledTrain";
export default interface Station { export default interface Station {
@@ -37,12 +36,10 @@ export default interface Station {
twoWay: { catenary: number; noCatenary: number }; twoWay: { catenary: number; noCatenary: number };
}; };
checkpoints: checkpoints: {
| { checkpointName: string;
checkpointName: string; scheduledTrains: ScheduledTrain[];
scheduledTrains: ScheduledTrain[]; }[];
}[]
| null;
stops: string[] | null; stops: string[] | null;
+4 -2
View File
@@ -264,7 +264,7 @@ export const store = createStore<State>({
noCatenary: station[13] as number 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[], stops: station[15] as string[],
default: station[16] as boolean, 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 (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 (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 (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.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; return false;
}); });