@transportme/load-ptv-gtfs 1.4.12 → 1.4.14
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.
|
@@ -8,9 +8,9 @@ import { minutesPastMidnightToHHMM } from '../utils.mjs'
|
|
|
8
8
|
|
|
9
9
|
export default class TripLoader {
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
routes
|
|
12
|
+
stops
|
|
13
|
+
trips
|
|
14
14
|
|
|
15
15
|
#tripsReader
|
|
16
16
|
#stopTimesReader
|
|
@@ -44,9 +44,9 @@ export default class TripLoader {
|
|
|
44
44
|
* @param {DatabaseConnection} database A database connection
|
|
45
45
|
*/
|
|
46
46
|
constructor({ tripsFile, stopTimesFile, calendarFile, calendarDatesFile }, mode, database) {
|
|
47
|
-
this
|
|
48
|
-
this
|
|
49
|
-
this
|
|
47
|
+
this.routes = this.getRoutesDB(database)
|
|
48
|
+
this.stops = this.getStopsDB(database)
|
|
49
|
+
this.trips = this.getTripsDB(database)
|
|
50
50
|
|
|
51
51
|
this.#mode = mode
|
|
52
52
|
|
|
@@ -104,7 +104,7 @@ export default class TripLoader {
|
|
|
104
104
|
async findMatchingRoute(routeGTFSID) {
|
|
105
105
|
if (this.#routeCache[routeGTFSID]) return this.#routeCache[routeGTFSID]
|
|
106
106
|
|
|
107
|
-
let route = await this
|
|
107
|
+
let route = await this.routes.findDocument({
|
|
108
108
|
routeGTFSID: routeGTFSID
|
|
109
109
|
})
|
|
110
110
|
|
|
@@ -115,7 +115,7 @@ export default class TripLoader {
|
|
|
115
115
|
async findMatchingStop(stopGTFSID) {
|
|
116
116
|
if (this.#stopCache[stopGTFSID]) return this.#stopCache[stopGTFSID]
|
|
117
117
|
|
|
118
|
-
let stop = await this
|
|
118
|
+
let stop = await this.stops.findDocument({
|
|
119
119
|
'bays.stopGTFSID': stopGTFSID
|
|
120
120
|
})
|
|
121
121
|
|
|
@@ -259,7 +259,7 @@ export default class TripLoader {
|
|
|
259
259
|
|
|
260
260
|
async writeTrips() {
|
|
261
261
|
if (this.getTripsToLoad().length) {
|
|
262
|
-
await this
|
|
262
|
+
await this.trips.createDocuments(this.getTripsToLoad())
|
|
263
263
|
this.clearTripsToLoad()
|
|
264
264
|
}
|
|
265
265
|
}
|