diff --git a/docker-compose.yml b/docker-compose.yml index 1ed55a8b..91b4a8c2 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -13,7 +13,7 @@ services: - /usr/src/app/node_modules ghopper: - image: cornellappdev/transit-ghopper:v1.0.0 + image: cornellappdev/transit-ghopper:v1.0.2 ports: - "8988:8988" @@ -28,7 +28,7 @@ services: - "8987:8987" live-tracking: - image: cornellappdev/transit-python:v1.0.0 + image: cornellappdev/transit-python:v1.0.2 env_file: python.envrc ports: - "5000:5000" diff --git a/src/utils/ParseRouteUtils.js b/src/utils/ParseRouteUtils.js index 17b1872a..39b69f9a 100644 --- a/src/utils/ParseRouteUtils.js +++ b/src/utils/ParseRouteUtils.js @@ -1,6 +1,7 @@ // @flow import createGpx from 'gps-to-gpx'; +import { isNullOrUndefined } from 'util'; import { MAP_MATCHING } from './EnvUtils'; import AllStopUtils from './AllStopUtils'; import GTFSUtils from './GTFSUtils'; @@ -65,7 +66,25 @@ function mergeDirections(first, second): Object { const stops = first.stops.concat(second.stops); const tripIDs = first.tripIdentifiers.concat(second.tripIdentifiers); + // The combined delay is only the first bus route's delay, because that is + // how much the combined route is initially delayed by and is what the user + // needs to know in order to board the route on time. + const delay = isNullOrUndefined(first.delay) ? null : first.delay; + + // If there is any part of the bus route that a passenger does not stay on for + // transfer, then the passenger has to get off the bus at some point, so + // stayOnBusForTransfer is false if either route's stayOnBusForTransfer is false. + const firstStayOnBusForTransfer = isNullOrUndefined( + first.stayOnBusForTransfer, + ) ? false : first.stayOnBusForTransfer; + const secondStayOnBusForTransfer = isNullOrUndefined( + second.stayOnBusForTransfer, + ) ? false : second.stayOnBusForTransfer; + const stayOnBusForTransfer = firstStayOnBusForTransfer + && secondStayOnBusForTransfer; + return { + delay, distance, endLocation: second.endLocation, endTime: second.endTime, @@ -74,6 +93,7 @@ function mergeDirections(first, second): Object { routeNumber: first.routeNumber, startLocation: first.startLocation, startTime: first.startTime, + stayOnBusForTransfer, stops, tripIdentifiers: tripIDs, type: first.type,