Skip to content

Commit

Permalink
Handle day pass to Pace premium transfer
Browse files Browse the repository at this point in the history
  • Loading branch information
ansoncfit committed Nov 16, 2023
1 parent a440f0c commit 4403e8a
Showing 1 changed file with 12 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -182,22 +182,29 @@ public FareBounds calculateFare(McRaptorSuboptimalPathProfileRouter.McRaptorStat
Fare fare = fares.getFareOrDefault(null, boardStopZoneId, alightStopZoneId);
cumulativeFarePaid += payFullFare(fare);
} else {
// We have a pass offering unlimited rides, so continue
if (transferAllowance.unlimited) continue;

int fareToPay = 0;
if (agency == Agency.PACE) {
String shortenedRouteId = route.route_id.split("-")[0];
if (paceFreeRoutes.contains(shortenedRouteId)) continue;
if (transferAllowance.unlimited) {
if (pacePremiumRoutes.contains(shortenedRouteId)) {
cumulativeFarePaid += PACE_PREMIUM_TRANSFER;
// TODO update transfer allowance to cover transfer to subsequent premium routes
}
continue;
}
if (pacePremiumRoutes.contains(shortenedRouteId)) fareToPay = PACE_PREMIUM_FARE;
else fareToPay = PACE_REGULAR_FARE;
} if (agency == Agency.CTA) {
// We have a pass offering unlimited rides, so continue
if (transferAllowance.unlimited) continue;

if (route.route_type == 1) {
// Boarding metro (CTA "L" service)
if (boardStation.equals("40890")) { // Boarding at O'Hare; buy a day pass to cover the surcharge
cumulativeFarePaid += CTA_PACE_DAY_PASS - transferAllowance.value;
transferAllowance = new CTAPaceTransferAllowance(true);
break;
continue;
}

if (ride > 0) {
Expand All @@ -211,7 +218,7 @@ public FareBounds calculateFare(McRaptorSuboptimalPathProfileRouter.McRaptorStat
String fromStation = transitLayer.parentStationIdForStop.get(fromStopIndex);
if (platformsConnected(fromStopIndex, fromStation, boardStopIndex, boardStation)) {
// Transfer behind gates, no Ventra tap or change in transfer allowance
break;
continue;
}
}
}
Expand All @@ -223,7 +230,6 @@ public FareBounds calculateFare(McRaptorSuboptimalPathProfileRouter.McRaptorStat
// We have a transfer to redeem
if (fareToPay <= transferAllowance.value) {
// No additional fare required to board
// TODO handle special case of PACE_PREMIUM_TRANSFER from day pass
transferAllowance = transferAllowance.redeem(fareToPay);
} else {
// Additional fare required (transferring to a more expensive service than previously ridden)
Expand Down

0 comments on commit 4403e8a

Please sign in to comment.