Poprawki w wyświetlaniu pociągów bez RJ

This commit is contained in:
2022-03-03 19:01:21 +01:00
parent ae08a64284
commit fb18a156d0
3 changed files with 12 additions and 8 deletions
+1
View File
@@ -15,6 +15,7 @@ export default interface Train {
locoURL: string; locoURL: string;
locoType: string; locoType: string;
online: boolean; online: boolean;
region: string;
cars: string[]; cars: string[];
+6 -4
View File
@@ -163,6 +163,7 @@ export const store = createStore<State>({
.filter(train => train.region === this.state.region.id && train.isOnline && train.station.stationName === station.stationName) .filter(train => train.region === this.state.region.id && train.isOnline && train.station.stationName === station.stationName)
.map(train => ({ driverName: train.driverName, trainNo: train.trainNo })) : []; .map(train => ({ driverName: train.driverName, trainNo: train.trainNo })) : [];
acc.push({ acc.push({
name: station.stationName, name: station.stationName,
hash: station.stationHash, hash: station.stationHash,
@@ -204,7 +205,7 @@ export const store = createStore<State>({
connectedTrack: train.dataSceneryConnection, connectedTrack: train.dataSceneryConnection,
locoType, locoType,
locoURL: getLocoURL(locoType), locoURL: getLocoURL(locoType),
cars: train.dataCon.split(";").filter((train, i) => i > 0) || [] cars: train.dataCon.split(";").filter((train, i) => i > 0) || [],
}; };
}) })
) : []; ) : [];
@@ -465,7 +466,8 @@ export const store = createStore<State>({
return acc; return acc;
}, [] as Train[]); }, [] as Train[]);
state.trainCount = state.trainList.filter(train => train.online).length; state.trainCount = state.trainList.length;
state.dataConnectionStatus = DataStatus.Loaded; state.dataConnectionStatus = DataStatus.Loaded;
}, },
@@ -573,7 +575,7 @@ export const store = createStore<State>({
const timetable = timetableList.find(tt => tt.data && tt.trainNo === train.trainNo && tt.data.driverId === train.driverId); const timetable = timetableList.find(tt => tt.data && tt.trainNo === train.trainNo && tt.data.driverId === train.driverId);
const allTimetables = timetableList.filter(tt => tt.data && tt.data.driverId === train.driverId && tt.trainNo !== train.trainNo); const allTimetables = timetableList.filter(tt => tt.data && tt.data.driverId === train.driverId && tt.trainNo !== train.trainNo);
if (!timetable || !timetable.data) return acc; // if (!timetable || !timetable.data) return acc;
if (allTimetables.length > 0) if (allTimetables.length > 0)
return acc; return acc;
@@ -582,7 +584,7 @@ export const store = createStore<State>({
.find(station => station.name === train.currentStationName) .find(station => station.name === train.currentStationName)
?.onlineInfo?.scheduledTrains?.find(stationTrain => stationTrain.trainNo === train.trainNo); ?.onlineInfo?.scheduledTrains?.find(stationTrain => stationTrain.trainNo === train.trainNo);
acc.push({ ...train, timetableData: timetable.data, stopStatus: trainStopData?.stopStatus || "", stopLabel: trainStopData?.stopLabel || "" }); acc.push({ ...train, timetableData: timetable?.data, stopStatus: trainStopData?.stopStatus || "", stopLabel: trainStopData?.stopLabel || "" });
return acc; return acc;
}, [] as Train[]); }, [] as Train[]);
+3 -2
View File
@@ -48,6 +48,7 @@ const filteredTrainList = (
searchedDriver: string, searchedDriver: string,
sorterActive: { id: string; dir: number } sorterActive: { id: string; dir: number }
) => { ) => {
return trainList return trainList
.filter( .filter(
(train) => (train) =>
@@ -113,12 +114,12 @@ export default defineComponent({
trainStatsOpen: false, trainStatsOpen: false,
}), }),
setup(props) { setup() {
const store = useStore(); const store = useStore();
const trainList: ComputedRef<Train[]> = computed(() => store.getters[GETTERS.trainList]); const trainList: ComputedRef<Train[]> = computed(() => store.getters[GETTERS.trainList]);
const timetableDataStatus: ComputedRef<DataStatus> = computed(() => store.getters[GETTERS.timetableDataStatus]); // const timetableDataStatus: ComputedRef<DataStatus> = computed(() => store.getters[GETTERS.timetableDataStatus]);
const sorterActive = ref({ id: 'distance', dir: -1 }); const sorterActive = ref({ id: 'distance', dir: -1 });
const searchedDriver = ref(''); const searchedDriver = ref('');