@transportme/load-ptv-gtfs 1.4.30 → 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 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 = {
@@ -151,12 +151,17 @@ export class SmartrakTrip extends GTFSTrip {
151
151
  }
152
152
 
153
153
  getRunID() {
154
- const tripIDParts = this.getTripID().split('-')
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 = this.getCalendarName().split('-')[0].replace(/\d+/, '')
162
+ const rosterType = tripIDParts[4].replace(/\d+/, '')
158
163
  const tripRunID = tripIDParts[5]
159
- return `${this.getDepotID()}-${routeNumber}-${routeVariant}-${rosterType}-${tripRunID}`
164
+ return `${depotID}-${routeNumber}-${routeVariant}-${rosterType}-${tripRunID}`
160
165
  }
161
166
  }
162
167
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@transportme/load-ptv-gtfs",
3
- "version": "1.4.30",
3
+ "version": "1.4.31",
4
4
  "description": "",
5
5
  "main": "index.mjs",
6
6
  "scripts": {