From 2ff938fe8476422ad8f4c66e6dc5323998be9abe Mon Sep 17 00:00:00 2001 From: Julian Rojas Date: Thu, 7 Jul 2022 17:51:14 +0200 Subject: [PATCH 1/3] Do not set 0 delays in static history as this assumes they are known --- lib/stoptimes/st2c.js | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/lib/stoptimes/st2c.js b/lib/stoptimes/st2c.js index ec75b5b..66296ad 100644 --- a/lib/stoptimes/st2c.js +++ b/lib/stoptimes/st2c.js @@ -144,15 +144,10 @@ } catch (err) { if (err.code === 'LEVEL_NOT_FOUND') { // Is a completely new Connection rule, create history structure - // for this connection rule and add parameters that could only be - // updated in GTFS-realtime data updates. + // for this connection rule. const history = {}; serviceDates.forEach(sd => { - history[sd] = { - type: 'Connection', - departureDelay: 0, - arrivalDelay: 0 - }; + history[sd] = { type: 'Connection' }; }); await this.historyDB.put(id, history); return serviceDates; From adcea9c867aa3b5354273560376ba4fc4839dc94 Mon Sep 17 00:00:00 2001 From: Julian Rojas Date: Thu, 7 Jul 2022 17:51:36 +0200 Subject: [PATCH 2/3] 2.1.3 --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index f956cf4..4faa6f7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "gtfs2lc", - "version": "2.1.2", + "version": "2.1.3", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "gtfs2lc", - "version": "2.1.2", + "version": "2.1.3", "license": "MIT", "dependencies": { "commander": "^4.1.1", diff --git a/package.json b/package.json index e080e2b..fc2cbd8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "gtfs2lc", - "version": "2.1.2", + "version": "2.1.3", "description": "Mapping script from gtfs to (linked) connections", "main": "lib/gtfs2lc.js", "bin": { From ecf6fc1594ea7598557ae1263a6c23b836b37501 Mon Sep 17 00:00:00 2001 From: Julian Rojas Date: Thu, 7 Jul 2022 18:01:45 +0200 Subject: [PATCH 3/3] Increase test coverage --- test/URIStrategy.test.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/test/URIStrategy.test.js b/test/URIStrategy.test.js index 1cda29e..513c0d8 100644 --- a/test/URIStrategy.test.js +++ b/test/URIStrategy.test.js @@ -85,17 +85,19 @@ describe('URIStrategy', () => { it('should resolve expression using date-fns.format function', () => { const strategy = new URIStrategy({ connection: - 'http://example.org/connections/{trip_startTime}/{departureStop}/{trip_id}{connection.something}', + 'http://example.org/connections/{trip_startTime}/{departureStop}/{connection.departureStop}/{connection.arrivalStop}/{trip_id}{connection.something}', resolve: { trip_id: 'connection.trip.trip_id', trip_startTime: 'format(connection.trip.startTime, "yyyyMMdd\'T\'HHmm");', - departureStop: 'connection.departureStop', + departureStop: 'connection.stopId', }, }); const connection = { something: 'some', - departureStop: '1234', + stopId: '1234', + departureStop: { stop_id: '1234' }, + arrivalStop: { stop_id: '4321' }, trip: { trip_id: '5678', startTime: new Date('2018-09-21T10:25:12'), @@ -104,7 +106,7 @@ describe('URIStrategy', () => { assert.equal( strategy.getId(connection), - 'http://example.org/connections/20180921T1025/1234/5678some' + 'http://example.org/connections/20180921T1025/1234/1234/4321/5678some' ); }); });