Skip to content

Commit

Permalink
Fix unique ID building for checking historic records
Browse files Browse the repository at this point in the history
  • Loading branch information
julianrojas87 committed Jul 7, 2022
1 parent 00544ca commit 70ddd4b
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions lib/Gtfsrt2LC.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,10 +154,10 @@ class Gtfsrt2LC {
route: r,
trip: t,
stopTimes: st,
cu,
ncu: completedUpdates[j + 1],
cu: await this.getStop(cu.stopId),
ncu: await this.getStop(completedUpdates[j + 1].stopId),
pdIndex,
startTime: tripUpdate.trip.startTime,
startTime: format(tripStartTime, 'H:mm:ss'),
startDate,
departureDelay,
arrivalDelay,
Expand Down Expand Up @@ -642,11 +642,16 @@ class Gtfsrt2LC {
} = params;

// Build Connection's original rule as in gtfs2lc
const depStopId = cu['stop_code'] && cu['stop_code'] !== '' ?
cu['stop_code'] : cu['stop_id'];
const arrStopId = ncu['stop_code'] && ncu['stop_code'] !== '' ?
ncu['stop_code'] : ncu['stop_id'];

const uniqueId = [
route['route_long_name'].replace(/\s/g, ''),
trip['trip_short_name'],
cu['stopId'],
ncu['stopId'],
depStopId,
arrStopId,
startTime,
stopTimes[pdIndex]['departure_time'],
stopTimes[pdIndex + 1]['arrival_time'],
Expand Down

0 comments on commit 70ddd4b

Please sign in to comment.