Poprawiono błędy z przydzielaniem rozkładów do scenerii.

This commit is contained in:
2020-09-12 19:03:10 +02:00
parent 19e82c7029
commit aaccf162d9
4 changed files with 58 additions and 37 deletions
+4 -3
View File
@@ -142,9 +142,8 @@ export default class TrainTable extends Vue {
return stops.reduce((acc, stop, i) => { return stops.reduce((acc, stop, i) => {
if (stop.stopType.includes("ph")) acc.push(`<strong>${stop.stopName}</strong>`); if (stop.stopType.includes("ph")) acc.push(`<strong>${stop.stopName}</strong>`);
else if (i > 0 && i < stops.length - 1) acc.push(`<span style='color: #ccc;'>${stop.stopName}</span>`); else if (i > 0 && i < stops.length - 1 && !stop.stopName.includes("po."))
// if (stop.stopType == "podg.") acc.push(`<span style='color: #ccc;'>${stop.stopName}</span>`); acc.push(`<span style='color: #ccc;'>${stop.stopName.includes("podg.") ? stop.stopName.split(",")[0] : stop.stopName}</span>`);
return acc; return acc;
}, []).join(" * "); }, []).join(" * ");
} }
@@ -216,6 +215,8 @@ export default class TrainTable extends Vue {
&-stations { &-stations {
margin-top: 0.35em; margin-top: 0.35em;
margin-bottom: 1rem;
font-size: 0.75em; font-size: 0.75em;
} }
+17 -9
View File
@@ -44,7 +44,8 @@
} }
}, },
"default": false, "default": false,
"nonPublic": true "nonPublic": true,
"stops": ["Borowe, podg.", "Wysoka, podg.", "Naprawa, podg."]
}, },
{ {
"stationName": "LCS Gdańsk", "stationName": "LCS Gdańsk",
@@ -68,7 +69,8 @@
} }
}, },
"default": true, "default": true,
"nonPublic": false "nonPublic": false,
"stops": ["Gdańsk Główny"]
}, },
{ {
"stationName": "Lębork", "stationName": "Lębork",
@@ -260,7 +262,8 @@
} }
}, },
"default": true, "default": true,
"nonPublic": false "nonPublic": false,
"stops": ["Głowno"]
}, },
{ {
"stationName": "LCS Ozorków", "stationName": "LCS Ozorków",
@@ -284,7 +287,8 @@
} }
}, },
"default": true, "default": true,
"nonPublic": false "nonPublic": false,
"stops": ["Ozorków"]
}, },
{ {
"stationName": "LCS Skrzynki", "stationName": "LCS Skrzynki",
@@ -308,7 +312,8 @@
} }
}, },
"default": true, "default": true,
"nonPublic": false "nonPublic": false,
"stops": ["Skrzynki"]
}, },
{ {
"stationName": "Łask", "stationName": "Łask",
@@ -428,7 +433,8 @@
} }
}, },
"default": true, "default": true,
"nonPublic": false "nonPublic": false,
"stops": ["Tłoki, podg."]
}, },
{ {
"stationName": "Witaszyczki", "stationName": "Witaszyczki",
@@ -764,7 +770,8 @@
} }
}, },
"default": true, "default": true,
"nonPublic": false "nonPublic": false,
"stops": ["Bucz Wileński"]
}, },
{ {
"stationName": "Lisiczki", "stationName": "Lisiczki",
@@ -1309,7 +1316,7 @@
"reqLevel": "2", "reqLevel": "2",
"supportersOnly": "NIE", "supportersOnly": "NIE",
"signalType": "współczesna", "signalType": "współczesna",
"controlType": "SCS", "controlType": "SPK",
"SBL": "", "SBL": "",
"twoWayBlock": "TAK", "twoWayBlock": "TAK",
"routes": { "routes": {
@@ -1856,6 +1863,7 @@
}, },
"default": false, "default": false,
"nonPublic": false, "nonPublic": false,
"unavailable": true "unavailable": true,
"stops": ["Sroka, podg."]
} }
] ]
+2
View File
@@ -19,7 +19,9 @@ export default interface Train {
route: string; route: string;
followingStops: { followingStops: {
stopName: string; stopName: string;
stopNameRAW: string;
stopType: string; stopType: string;
mainStop: boolean;
arrivalLine?: string; arrivalLine?: string;
arrivalTime: number; arrivalTime: number;
arrivalDelay: number; arrivalDelay: number;
+35 -25
View File
@@ -143,27 +143,33 @@ export default class Store extends VuexModule {
// stopObj.stopType = point.pointStopType; // stopObj.stopType = point.pointStopType;
// } // }
if (!point.pointName.includes('Południowy') && (point.pointName.includes('strong') || point.pointName.includes('podg.'))) { // if (point.pointNameRAW.includes('Południowy')) return acc;
if (point.pointName.includes('strong')) { // if (
stopObj.stopName = point.pointNameRAW; // !point.pointName.includes('strong') ||
stopObj.stopType = point.pointStopType; // !(point.pointNameRAW.includes('podg.') || JSONStationData.some(data => data.stationName.toLowerCase().includes(point.pointNameRAW.split(',')[0].toLowerCase())))
} else if (JSONStationData.some(data => data.stationName.toLowerCase().includes(point.pointNameRAW.split(',')[0].toLowerCase()))) { // )
stopObj.stopName = point.pointNameRAW.split(',')[0]; // return acc;
stopObj.stopType = 'pt podg.';
}
stopObj.arrivalTime = getTimestamp(point.arrivalTime); // stopObj.stopName = point.pointName.includes('strong') ? point.pointNameRAW : point.pointNameRAW.split(',')[0];
stopObj.departureTime = getTimestamp(point.departureTime); // stopObj.stopType = point.pointName.includes('strong') ? point.pointStopType : 'pt podg.';
stopObj.arrivalDelay = point.arrivalDelay;
stopObj.departureDelay = point.departureDelay;
stopObj.beginsHere = getTimestamp(point.arrivalTime) == 0 ? true : false;
stopObj.terminatesHere = getTimestamp(point.departureTime) == 0 ? true : false;
stopObj.confirmed = point.confirmed;
stopObj.stopped = point.isStopped;
stopObj.stopTime = point.pointStopTime;
acc.push(stopObj); stopObj.stopName = point.pointName;
} stopObj.stopNameRAW = point.pointNameRAW;
stopObj.stopType = point.pointStopType;
stopObj.mainStop = point.pointName.includes('strong');
stopObj.arrivalTime = getTimestamp(point.arrivalTime);
stopObj.departureTime = getTimestamp(point.departureTime);
stopObj.arrivalDelay = point.arrivalDelay;
stopObj.departureDelay = point.departureDelay;
stopObj.beginsHere = getTimestamp(point.arrivalTime) == 0 ? true : false;
stopObj.terminatesHere = getTimestamp(point.departureTime) == 0 ? true : false;
stopObj.confirmed = point.confirmed;
stopObj.stopped = point.isStopped;
stopObj.stopTime = point.pointStopTime;
acc.push(stopObj);
return acc; return acc;
}, []); }, []);
@@ -353,12 +359,16 @@ export default class Store extends VuexModule {
this.stationList = this.stationList.map(station => { this.stationList = this.stationList.map(station => {
const scheduledTrains = timetableList.reduce((acc, timetableData: any) => { const scheduledTrains = timetableList.reduce((acc, timetableData: any) => {
const scheduledIndex = timetableData const scheduledIndex = timetableData
? timetableData.followingStops.findIndex( ? timetableData.followingStops.findIndex((stop: any) => {
(stop: any) => const stationName = station.stationName.toLowerCase();
station.stationName.toLowerCase().includes(stop.stopName) || const stopName = stop.stopNameRAW.toLowerCase();
station.stationName.toLowerCase().includes(stop.stopName.toLowerCase().split(',')[0]) ||
(station.stationName.toLowerCase().includes(stop.stopName.toLowerCase().split(' ')[0]) && station.stationName.toLowerCase().includes('lcs')) return (
) stationName.includes(stopName) ||
(stopName.includes('podg.') && stopName.split(', podg.')[0] && stationName.includes(stopName.split(', podg.')[0])) ||
(stationName.includes('lcs') && JSONStationData.some(data => data.stationName.includes(station.stationName) && data.stops && data.stops.includes(stop.stopNameRAW)))
);
})
: -1; : -1;
if (scheduledIndex >= 0) { if (scheduledIndex >= 0) {