From aaccf162d943f87ed1fdcf1c3ba59b6d175a20f0 Mon Sep 17 00:00:00 2001 From: Spythere Date: Sat, 12 Sep 2020 19:03:10 +0200 Subject: [PATCH] =?UTF-8?q?Poprawiono=20b=C5=82=C4=99dy=20z=20przydzielani?= =?UTF-8?q?em=20rozk=C5=82ad=C3=B3w=20do=20scenerii.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/TrainsView/TrainTable.vue | 7 +-- src/data/stations.json | 26 ++++++---- src/scripts/interfaces/Train.ts | 2 + src/store/store.ts | 60 ++++++++++++++---------- 4 files changed, 58 insertions(+), 37 deletions(-) diff --git a/src/components/TrainsView/TrainTable.vue b/src/components/TrainsView/TrainTable.vue index 8eb1fd6..72b2372 100644 --- a/src/components/TrainsView/TrainTable.vue +++ b/src/components/TrainsView/TrainTable.vue @@ -142,9 +142,8 @@ export default class TrainTable extends Vue { return stops.reduce((acc, stop, i) => { if (stop.stopType.includes("ph")) acc.push(`${stop.stopName}`); - else if (i > 0 && i < stops.length - 1) acc.push(`${stop.stopName}`); - // if (stop.stopType == "podg.") acc.push(`${stop.stopName}`); - + else if (i > 0 && i < stops.length - 1 && !stop.stopName.includes("po.")) + acc.push(`${stop.stopName.includes("podg.") ? stop.stopName.split(",")[0] : stop.stopName}`); 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; } diff --git a/src/data/stations.json b/src/data/stations.json index e71898d..2a81463 100644 --- a/src/data/stations.json +++ b/src/data/stations.json @@ -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."] } ] \ No newline at end of file diff --git a/src/scripts/interfaces/Train.ts b/src/scripts/interfaces/Train.ts index c236921..0e7c3a0 100644 --- a/src/scripts/interfaces/Train.ts +++ b/src/scripts/interfaces/Train.ts @@ -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; diff --git a/src/store/store.ts b/src/store/store.ts index 31c3630..e28badc 100644 --- a/src/store/store.ts +++ b/src/store/store.ts @@ -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) {