@transportme/load-ptv-gtfs 1.4.29 → 1.4.31
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.mjs +2 -2
- package/lib/gtfs-parser/GTFSTrip.mjs +9 -4
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -10,7 +10,7 @@ import GTFSRoute from './lib/gtfs-parser/GTFSRoute.mjs'
|
|
|
10
10
|
import { GTFSShape, GTFSShapePoint } from './lib/gtfs-parser/GTFSShape.mjs'
|
|
11
11
|
import { GTFSStop, GTFSPlatformStop } from './lib/gtfs-parser/GTFSStop.mjs'
|
|
12
12
|
import { GTFSStopTime } from './lib/gtfs-parser/GTFSStopTime.mjs'
|
|
13
|
-
import GTFSTrip from './lib/gtfs-parser/GTFSTrip.mjs'
|
|
13
|
+
import GTFSTrip, { IdentifiableTrip, SmartrakTrip } from './lib/gtfs-parser/GTFSTrip.mjs'
|
|
14
14
|
|
|
15
15
|
import setRouteStops from './lib/post-processing/set-route-stops.mjs'
|
|
16
16
|
|
|
@@ -29,7 +29,7 @@ const GTFSTypes = {
|
|
|
29
29
|
GTFSAgency, GTFSCalendar, GTFSCalendarDate,
|
|
30
30
|
GTFSRoute, GTFSShape, GTFSShapePoint,
|
|
31
31
|
GTFSStop, GTFSPlatformStop,
|
|
32
|
-
GTFSStopTime, GTFSTrip
|
|
32
|
+
GTFSStopTime, GTFSTrip, SmartrakTrip, IdentifiableTrip
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
const GTFSReaders = {
|
|
@@ -142,7 +142,7 @@ export class SmartrakTrip extends GTFSTrip {
|
|
|
142
142
|
return {
|
|
143
143
|
...super.getTripData(),
|
|
144
144
|
depotID: this.getDepotID(),
|
|
145
|
-
runID: this.
|
|
145
|
+
runID: this.getRunID()
|
|
146
146
|
}
|
|
147
147
|
}
|
|
148
148
|
|
|
@@ -151,12 +151,17 @@ export class SmartrakTrip extends GTFSTrip {
|
|
|
151
151
|
}
|
|
152
152
|
|
|
153
153
|
getRunID() {
|
|
154
|
-
|
|
154
|
+
return this.constructor.getRunIDFromTripID(this.getTripID())
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
static getRunIDFromTripID(tripID) {
|
|
158
|
+
const tripIDParts = tripID.split('-')
|
|
159
|
+
const depotID = tripIDParts[0]
|
|
155
160
|
const routeNumber = tripIDParts[1]
|
|
156
161
|
const routeVariant = tripIDParts[2]
|
|
157
|
-
const rosterType =
|
|
162
|
+
const rosterType = tripIDParts[4].replace(/\d+/, '')
|
|
158
163
|
const tripRunID = tripIDParts[5]
|
|
159
|
-
return `${
|
|
164
|
+
return `${depotID}-${routeNumber}-${routeVariant}-${rosterType}-${tripRunID}`
|
|
160
165
|
}
|
|
161
166
|
}
|
|
162
167
|
|