@transportme/load-ptv-gtfs 1.4.27 → 1.4.29
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.
|
@@ -65,6 +65,7 @@ export default class GTFSTrip {
|
|
|
65
65
|
return {
|
|
66
66
|
routeGTFSID: this.getRouteGTFSID(),
|
|
67
67
|
operationDays: this.getOperationDays(),
|
|
68
|
+
calendarID: this.getCalendarName(),
|
|
68
69
|
tripID: this.getTripID(),
|
|
69
70
|
shapeID: this.getShapeID(),
|
|
70
71
|
block: this.getBlock(),
|
|
@@ -111,6 +112,8 @@ export default class GTFSTrip {
|
|
|
111
112
|
getStopData() {
|
|
112
113
|
return this.#stopData
|
|
113
114
|
}
|
|
115
|
+
|
|
116
|
+
getRunID() { return null }
|
|
114
117
|
}
|
|
115
118
|
|
|
116
119
|
/**
|
|
@@ -147,6 +150,14 @@ export class SmartrakTrip extends GTFSTrip {
|
|
|
147
150
|
return parseInt(this.#depotID)
|
|
148
151
|
}
|
|
149
152
|
|
|
153
|
+
getRunID() {
|
|
154
|
+
const tripIDParts = this.getTripID().split('-')
|
|
155
|
+
const routeNumber = tripIDParts[1]
|
|
156
|
+
const routeVariant = tripIDParts[2]
|
|
157
|
+
const rosterType = this.getCalendarName().split('-')[0].replace(/\d+/, '')
|
|
158
|
+
const tripRunID = tripIDParts[5]
|
|
159
|
+
return `${this.getDepotID()}-${routeNumber}-${routeVariant}-${rosterType}-${tripRunID}`
|
|
160
|
+
}
|
|
150
161
|
}
|
|
151
162
|
|
|
152
163
|
/**
|
|
@@ -51,7 +51,11 @@ export default class GTFSStopTimesReader {
|
|
|
51
51
|
|
|
52
52
|
return {
|
|
53
53
|
tripID,
|
|
54
|
-
stops: lines.map(line => this.processEntity(line))
|
|
54
|
+
stops: lines.map(line => this.processEntity(line)).filter((stop, i, arr) => {
|
|
55
|
+
if (i === 0) return true
|
|
56
|
+
const prev = arr[i - 1]
|
|
57
|
+
return !(prev.stopID === stop.stopID && prev.stopSequence === stop.stopSequence)
|
|
58
|
+
})
|
|
55
59
|
}
|
|
56
60
|
}
|
|
57
61
|
|