mirror of
https://github.com/Spythere/stacjownik.git
synced 2026-05-04 13:58:12 +00:00
Aktualizacja listy scenerii. Poprawki w wyświetlaniu rozkładów jazdy.
This commit is contained in:
@@ -2101,5 +2101,28 @@
|
|||||||
},
|
},
|
||||||
"default": false,
|
"default": false,
|
||||||
"nonPublic": false
|
"nonPublic": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"stationName": "Zgierz",
|
||||||
|
"stationURL": "https://td2.info.pl/scenerie/zgierz/",
|
||||||
|
"stationLines": "15,16",
|
||||||
|
"reqLevel": "12",
|
||||||
|
"supportersOnly": "TAK",
|
||||||
|
"signalType": "współczesna",
|
||||||
|
"controlType": "mechaniczne",
|
||||||
|
"SBL": "",
|
||||||
|
"twoWayBlock": "",
|
||||||
|
"routes": {
|
||||||
|
"oneWay": {
|
||||||
|
"catenary": 3,
|
||||||
|
"noCatenary": 0
|
||||||
|
},
|
||||||
|
"twoWay": {
|
||||||
|
"catenary": 1,
|
||||||
|
"noCatenary": 0
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"default": false,
|
||||||
|
"nonPublic": false
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -15,4 +15,5 @@ export default interface ScheduledTrain {
|
|||||||
|
|
||||||
stopLabel: string;
|
stopLabel: string;
|
||||||
stopStatus: string;
|
stopStatus: string;
|
||||||
|
stopStatusID: number;
|
||||||
}
|
}
|
||||||
+77
-98
@@ -214,7 +214,7 @@ export default class Store extends VuexModule {
|
|||||||
});
|
});
|
||||||
|
|
||||||
return acc;
|
return acc;
|
||||||
}, Promise.resolve([]))
|
}, Promise.resolve([]));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Action
|
@Action
|
||||||
@@ -314,7 +314,7 @@ export default class Store extends VuexModule {
|
|||||||
statusTimestamp: -3,
|
statusTimestamp: -3,
|
||||||
stationTrains: [],
|
stationTrains: [],
|
||||||
scheduledTrains: [],
|
scheduledTrains: [],
|
||||||
checkpoints: stationData.subStations ? stationData.subStations.map(sub => ({ checkpointName: sub, scheduledTrains: []})) : null,
|
checkpoints: stationData.subStations ? stationData.subStations.map(sub => ({ checkpointName: sub, scheduledTrains: [] })) : null,
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -381,7 +381,7 @@ export default class Store extends VuexModule {
|
|||||||
const trainData = this.trainList.find(train => train.trainNo === updatedTrain.trainNo);
|
const trainData = this.trainList.find(train => train.trainNo === updatedTrain.trainNo);
|
||||||
|
|
||||||
if (trainData) acc.push({ ...trainData, ...updatedTrain });
|
if (trainData) acc.push({ ...trainData, ...updatedTrain });
|
||||||
else acc.push({ ...updatedTrain });
|
else acc.push({ ...updatedTrain });
|
||||||
|
|
||||||
return acc;
|
return acc;
|
||||||
}, [] as Train[]);
|
}, [] as Train[]);
|
||||||
@@ -393,44 +393,61 @@ export default class Store extends VuexModule {
|
|||||||
@Mutation
|
@Mutation
|
||||||
private updateTimetableData(timetableList: TimetableData[]) {
|
private updateTimetableData(timetableList: TimetableData[]) {
|
||||||
this.stationList = this.stationList.map(station => {
|
this.stationList = this.stationList.map(station => {
|
||||||
|
|
||||||
const stationName = station.stationName.toLowerCase();
|
const stationName = station.stationName.toLowerCase();
|
||||||
const scheduledTrains: Station['scheduledTrains'] = timetableList.reduce((acc: Station['scheduledTrains'], timetableData: TimetableData, index) => {
|
const scheduledTrains: Station['scheduledTrains'] = timetableList.reduce((acc: Station['scheduledTrains'], timetableData: TimetableData, index) => {
|
||||||
|
const stopInfoIndex = timetableData.followingStops.findIndex(stop => {
|
||||||
const stopInfoIndex = timetableData.followingStops.findIndex((stop) => {
|
|
||||||
const stopName = stop.stopNameRAW.toLowerCase();
|
const stopName = stop.stopNameRAW.toLowerCase();
|
||||||
|
|
||||||
if (stationName === stopName) return true;
|
if (stationName === stopName) return true;
|
||||||
if (stopName.includes(stationName)) return true;
|
if (stopName.includes(stationName)) return true;
|
||||||
if (stationName.includes(stopName)) return true;
|
if (stationName.includes(stopName)) 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 (JSONStationData.some(data => data.stationName.includes(station.stationName) && data.stops && data.stops.includes(stop.stopNameRAW))) return true;
|
if (JSONStationData.some(data => data.stationName.includes(station.stationName) && data.stops && data.stops.includes(stop.stopNameRAW))) return true;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
if (stopInfoIndex == -1)
|
if (stopInfoIndex == -1) return acc;
|
||||||
return acc;
|
|
||||||
|
|
||||||
const stopInfo = timetableData.followingStops[stopInfoIndex];
|
const stopInfo = timetableData.followingStops[stopInfoIndex];
|
||||||
|
|
||||||
let stopStatus = "";
|
let stopStatus = '';
|
||||||
let stopLabel = "";
|
let stopLabel = '';
|
||||||
let nearestStop = "";
|
let stopStatusID = 0;
|
||||||
|
let nearestStop = '';
|
||||||
|
|
||||||
if (stopInfo.terminatesHere && stopInfo.confirmed) { stopStatus = "terminated"; stopLabel = "Skończył bieg" }
|
if (stopInfo.terminatesHere && stopInfo.confirmed) {
|
||||||
else if (!stopInfo.terminatesHere && stopInfo.confirmed) { stopStatus = "departed"; stopLabel = "Odprawiony" }
|
stopStatus = 'terminated';
|
||||||
// else if (timetableData.currentStationName == station.stationName && stopInfo.beginsHere ) { stopStatus = "online"; stopLabel = "Podstawia się" }
|
stopLabel = 'Skończył bieg';
|
||||||
else if (timetableData.currentStationName == station.stationName && !stopInfo.stopped) { stopStatus = "online"; stopLabel = "Na stacji" }
|
stopStatusID = 5;
|
||||||
else if (timetableData.currentStationName == station.stationName && stopInfo.stopped) { stopStatus = "stopped"; stopLabel = "Postój" }
|
} else if (!stopInfo.terminatesHere && stopInfo.confirmed && timetableData.currentStationName == station.stationName) {
|
||||||
else if (timetableData.currentStationName != station.stationName) { stopStatus = "arriving"; stopLabel = "W drodze" }
|
stopStatus = 'departed';
|
||||||
|
stopLabel = 'Odprawiony';
|
||||||
|
stopStatusID = 2;
|
||||||
|
} else if (!stopInfo.terminatesHere && stopInfo.confirmed && timetableData.currentStationName != station.stationName) {
|
||||||
|
stopStatus = 'departed-away';
|
||||||
|
stopLabel = 'Odjechał';
|
||||||
|
stopStatusID = 4;
|
||||||
|
} else if (timetableData.currentStationName == station.stationName && !stopInfo.stopped) {
|
||||||
|
stopStatus = 'online';
|
||||||
|
stopLabel = 'Na stacji';
|
||||||
|
stopStatusID = 0;
|
||||||
|
} else if (timetableData.currentStationName == station.stationName && stopInfo.stopped) {
|
||||||
|
stopStatus = 'stopped';
|
||||||
|
stopLabel = 'Postój';
|
||||||
|
stopStatusID = 1;
|
||||||
|
} else if (timetableData.currentStationName != station.stationName) {
|
||||||
|
stopStatus = 'arriving';
|
||||||
|
stopLabel = 'W drodze';
|
||||||
|
stopStatusID = 3;
|
||||||
|
}
|
||||||
|
|
||||||
for (let i = stopInfoIndex; i < timetableData.followingStops.length - 1; i++){
|
for (let i = stopInfoIndex; i < timetableData.followingStops.length - 1; i++) {
|
||||||
const stop = timetableData.followingStops[i];
|
const stop = timetableData.followingStops[i];
|
||||||
|
|
||||||
if (stop.mainStop && stop.stopType.includes("ph")) {
|
if (stop.mainStop && stop.stopType.includes('ph')) {
|
||||||
nearestStop = stop.stopNameRAW;
|
nearestStop = stop.stopNameRAW;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -448,29 +465,53 @@ export default class Store extends VuexModule {
|
|||||||
nearestStop,
|
nearestStop,
|
||||||
stopInfo,
|
stopInfo,
|
||||||
stopLabel,
|
stopLabel,
|
||||||
stopStatus
|
stopStatus,
|
||||||
|
stopStatusID,
|
||||||
});
|
});
|
||||||
|
|
||||||
return acc;
|
return acc;
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
if (station.checkpoints) {
|
if (station.checkpoints) {
|
||||||
station.checkpoints.forEach(cp => cp.scheduledTrains.length = 0)
|
station.checkpoints.forEach(cp => (cp.scheduledTrains.length = 0));
|
||||||
|
|
||||||
for (let checkpoint of station.checkpoints) {
|
for (let checkpoint of station.checkpoints) {
|
||||||
timetableList.reduce((acc, data) => {
|
timetableList.reduce((acc, data) => {
|
||||||
const foundStops = data.followingStops.filter(stop => stop.stopNameRAW === checkpoint.checkpointName).forEach(stopInfo => {
|
data.followingStops
|
||||||
|
.filter(stop => stop.stopNameRAW === checkpoint.checkpointName)
|
||||||
|
.forEach(stopInfo => {
|
||||||
// const stopInfo = data.followingStops[stopInfoIndex];
|
// const stopInfo = data.followingStops[stopInfoIndex];
|
||||||
|
|
||||||
let stopStatus = "";
|
let stopStatus = '';
|
||||||
let stopLabel = "";
|
let stopLabel = '';
|
||||||
let nearestStop = "";
|
let nearestStop = '';
|
||||||
|
let stopStatusID = 0;
|
||||||
|
|
||||||
if (stopInfo.terminatesHere && stopInfo.confirmed) { stopStatus = "terminated"; stopLabel = "Skończył bieg" }
|
if (stopInfo.terminatesHere && stopInfo.confirmed) {
|
||||||
else if (!stopInfo.terminatesHere && stopInfo.confirmed) { stopStatus = "departed"; stopLabel = "Odprawiony" }
|
stopStatus = 'terminated';
|
||||||
else if (data.currentStationName == station.stationName && !stopInfo.stopped) { stopStatus = "online"; stopLabel = "Na stacji" }
|
stopLabel = 'Skończył bieg';
|
||||||
else if (data.currentStationName == station.stationName && stopInfo.stopped) { stopStatus = "stopped"; stopLabel = "Postój" }
|
stopStatusID = 5;
|
||||||
else if (data.currentStationName != station.stationName) { stopStatus = "arriving"; stopLabel = "W drodze" }
|
} else if (!stopInfo.terminatesHere && stopInfo.confirmed && data.currentStationName == station.stationName) {
|
||||||
|
stopStatus = 'departed';
|
||||||
|
stopLabel = 'Odprawiony';
|
||||||
|
stopStatusID = 2;
|
||||||
|
} else if (!stopInfo.terminatesHere && stopInfo.confirmed && data.currentStationName != station.stationName) {
|
||||||
|
stopStatus = 'departed-away';
|
||||||
|
stopLabel = 'Odjechał';
|
||||||
|
stopStatusID = 4;
|
||||||
|
} else if (data.currentStationName == station.stationName && !stopInfo.stopped) {
|
||||||
|
stopStatus = 'online';
|
||||||
|
stopLabel = 'Na stacji';
|
||||||
|
stopStatusID = 0;
|
||||||
|
} else if (data.currentStationName == station.stationName && stopInfo.stopped) {
|
||||||
|
stopStatus = 'stopped';
|
||||||
|
stopLabel = 'Postój';
|
||||||
|
stopStatusID = 1;
|
||||||
|
} else if (data.currentStationName != station.stationName) {
|
||||||
|
stopStatus = 'arriving';
|
||||||
|
stopLabel = 'W drodze';
|
||||||
|
stopStatusID = 3;
|
||||||
|
}
|
||||||
|
|
||||||
// for (let i = stopInfoIndex; i < data.followingStops.length - 1; i++){
|
// for (let i = stopInfoIndex; i < data.followingStops.length - 1; i++){
|
||||||
// const stop = data.followingStops[i];
|
// const stop = data.followingStops[i];
|
||||||
@@ -493,88 +534,26 @@ export default class Store extends VuexModule {
|
|||||||
stopInfo,
|
stopInfo,
|
||||||
stopLabel,
|
stopLabel,
|
||||||
stopStatus,
|
stopStatus,
|
||||||
nearestStop
|
nearestStop,
|
||||||
|
stopStatusID,
|
||||||
});
|
});
|
||||||
})
|
});
|
||||||
|
|
||||||
return acc;
|
return acc;
|
||||||
}, []);
|
}, []);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// const checkpoints: Station['scheduledTrains'] = timetableList.reduce((acc: any, timetableData: TimetableData, index) => {
|
|
||||||
// const stopInfoIndex = timetableData.followingStops.findIndex((stop) => {
|
|
||||||
// const stopName = stop.stopNameRAW.toLowerCase();
|
|
||||||
|
|
||||||
// if (station.checkpoints?.some(cp => cp.checkpointName.includes(stopName))) return true;
|
|
||||||
// if (stopName.includes("podg.") && stopName.split(", podg.")[0] && station.checkpoints?.filter(cp => cp.checkpointName.includes(stopName.split(", podg.")[0]))) return true;
|
|
||||||
|
|
||||||
// return false;
|
|
||||||
// });
|
|
||||||
|
|
||||||
// if (stopInfoIndex == -1) return acc;
|
|
||||||
|
|
||||||
// const stopInfo = timetableData.followingStops[stopInfoIndex];
|
|
||||||
|
|
||||||
// let stopStatus = "";
|
|
||||||
// let stopLabel = "";
|
|
||||||
// let nearestStop = "";
|
|
||||||
|
|
||||||
// if (stopInfo.terminatesHere && stopInfo.confirmed) { stopStatus = "terminated"; stopLabel = "Skończył bieg" }
|
|
||||||
// else if (!stopInfo.terminatesHere && stopInfo.confirmed) { stopStatus = "departed"; stopLabel = "Odprawiony" }
|
|
||||||
// // else if (timetableData.currentStationName == station.stationName && stopInfo.beginsHere ) { stopStatus = "online"; stopLabel = "Podstawia się" }
|
|
||||||
// else if (timetableData.currentStationName == station.stationName && !stopInfo.stopped) { stopStatus = "online"; stopLabel = "Na stacji" }
|
|
||||||
// else if (timetableData.currentStationName == station.stationName && stopInfo.stopped) { stopStatus = "stopped"; stopLabel = "Postój" }
|
|
||||||
// else if (timetableData.currentStationName != station.stationName) { stopStatus = "arriving"; stopLabel = "W drodze" }
|
|
||||||
|
|
||||||
// for (let i = stopInfoIndex; i < timetableData.followingStops.length - 1; i++){
|
|
||||||
// const stop = timetableData.followingStops[i];
|
|
||||||
|
|
||||||
// if (stop.mainStop && stop.stopType.includes("ph")) {
|
|
||||||
// nearestStop = stop.stopNameRAW;
|
|
||||||
// break;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// acc.push({
|
|
||||||
// checkpointName: stopInfo.stopNameRAW,
|
|
||||||
// scheduledTrains: {
|
|
||||||
// trainNo: timetableData.trainNo,
|
|
||||||
// driverName: timetableData.driverName,
|
|
||||||
// driverId: timetableData.driverId,
|
|
||||||
// currentStationName: timetableData.currentStationName,
|
|
||||||
// currentStationHash: timetableData.currentStationHash,
|
|
||||||
// category: timetableData.category,
|
|
||||||
// beginsAt: timetableData.followingStops[0].stopNameRAW,
|
|
||||||
// terminatesAt: timetableData.followingStops[timetableData.followingStops.length - 1].stopNameRAW,
|
|
||||||
// nearestStop,
|
|
||||||
// stopInfo,
|
|
||||||
// stopLabel,
|
|
||||||
// stopStatus
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
|
|
||||||
// return acc;
|
|
||||||
// }, []);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return { ...station, scheduledTrains };
|
return { ...station, scheduledTrains };
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
this.trainList = this.trainList.reduce((acc, train) => {
|
this.trainList = this.trainList.reduce((acc, train) => {
|
||||||
const timetableData = timetableList.find(data => data && data.trainNo === train.trainNo);
|
const timetableData = timetableList.find(data => data && data.trainNo === train.trainNo);
|
||||||
|
|
||||||
if (timetableData) {
|
if (timetableData) {
|
||||||
const trainData = this.stationList
|
const trainData = this.stationList.find(station => station.stationName === train.currentStationName)?.scheduledTrains.find(stationTrain => stationTrain.trainNo === train.trainNo);
|
||||||
.find(station => station.stationName === train.currentStationName)?.scheduledTrains
|
|
||||||
.find(stationTrain => stationTrain.trainNo === train.trainNo);
|
|
||||||
|
|
||||||
acc.push({ ...train, timetableData, stopStatus: trainData?.stopStatus || "", stopLabel: trainData?.stopLabel || "" });
|
acc.push({ ...train, timetableData, stopStatus: trainData?.stopStatus || '', stopLabel: trainData?.stopLabel || '' });
|
||||||
}
|
}
|
||||||
|
|
||||||
return acc;
|
return acc;
|
||||||
|
|||||||
@@ -396,6 +396,9 @@ export default class SceneryView extends styleMixin {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
scheduledTrains?.sort((a, b) => {
|
scheduledTrains?.sort((a, b) => {
|
||||||
|
if (a.stopStatusID > b.stopStatusID) return 1;
|
||||||
|
else if (a.stopStatusID < b.stopStatusID) return -1;
|
||||||
|
|
||||||
if (a.stopInfo.arrivalTimestamp > b.stopInfo.arrivalTimestamp) return 1;
|
if (a.stopInfo.arrivalTimestamp > b.stopInfo.arrivalTimestamp) return 1;
|
||||||
else if (a.stopInfo.arrivalTimestamp < b.stopInfo.arrivalTimestamp)
|
else if (a.stopInfo.arrivalTimestamp < b.stopInfo.arrivalTimestamp)
|
||||||
return -1;
|
return -1;
|
||||||
@@ -815,6 +818,11 @@ h3 {
|
|||||||
span.departed {
|
span.departed {
|
||||||
color: lime;
|
color: lime;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
|
|
||||||
|
&-away {
|
||||||
|
font-weight: bold;
|
||||||
|
color: rgb(0, 155, 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
span.stopped {
|
span.stopped {
|
||||||
|
|||||||
Reference in New Issue
Block a user