Skip to content

Commit

Permalink
Fixes Bad request.
Browse files Browse the repository at this point in the history
Cause: DirectionId not defined in GTFS file.
This affects also synopticView.
Solution: Test first if directionId is null or undefined. In javascript,
the directionId is set to "0". In IpcRoute.java test if
directionId==null and currentDirectionId==null.
  • Loading branch information
vsperez committed Mar 16, 2019
1 parent 3960447 commit 2194b1d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ private static IpcDirectionsForRoute createStops(Route dbRoute,
if (stopId != null) {
isUiStop = false;
for (TripPattern tripPattern : uiTripPatterns) {
if(tripPattern.getDirectionId().compareTo(currentDirectionId)==0)
if((tripPattern.getDirectionId()==null && currentDirectionId==null) || tripPattern.getDirectionId().compareTo(currentDirectionId)==0)
currentTripPattern=tripPattern;
if (tripPattern.isStopAtOrAfterStop(stopId, currentStopId)) {
isUiStop = true;
Expand All @@ -233,7 +233,7 @@ private static IpcDirectionsForRoute createStops(Route dbRoute,
else
{
for (TripPattern tripPattern : uiTripPatterns) {
if(tripPattern.getDirectionId().compareTo(currentDirectionId)==0)
if((tripPattern.getDirectionId()==null && currentDirectionId==null) || tripPattern.getDirectionId().compareTo(currentDirectionId)==0)
currentTripPattern=tripPattern;
}
}
Expand Down
2 changes: 2 additions & 0 deletions transitclockWebapp/src/main/webapp/synoptic/index.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,8 @@ function routeConfigCallback(routeDetail, status)
var stop=routeDetail.routes[0].direction[i].stop[j];
distanceOverPath+=stop.pathLength;
var projectionStop=distanceOverPath/routeLenght;
if(stop.direction==undefined)
stop.direction="0";
var directionStop=(stop.direction==routeDetail.routes[0].direction[i].id=="0")?0:1;
stops.push({id: stop.id, identifier: stop.name,projection:projectionStop,direction:directionStop,distance:distanceOverPath});
}
Expand Down

0 comments on commit 2194b1d

Please sign in to comment.