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