Skip to content

Commit

Permalink
Merge pull request #136 from linkedconnections/development
Browse files Browse the repository at this point in the history
v2.1.3
  • Loading branch information
julianrojas87 committed Jul 7, 2022
2 parents 4f215d3 + ecf6fc1 commit 82c5ec7
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 14 deletions.
9 changes: 2 additions & 7 deletions lib/stoptimes/st2c.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand Down
10 changes: 6 additions & 4 deletions test/URIStrategy.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'),
Expand All @@ -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'
);
});
});
Expand Down

0 comments on commit 82c5ec7

Please sign in to comment.