Skip to content

Commit

Permalink
Remove unused GtfsGraphQlApiRentalStationFuzzyMatching feature
Browse files Browse the repository at this point in the history
  • Loading branch information
optionsome committed Nov 26, 2024
1 parent bc3147f commit 8f2c146
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 61 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
import org.opentripplanner.ext.fares.impl.DefaultFareService;
import org.opentripplanner.ext.fares.impl.GtfsFaresService;
import org.opentripplanner.ext.fares.model.FareRuleSet;
import org.opentripplanner.framework.application.OTPFeature;
import org.opentripplanner.graph_builder.issue.api.DataImportIssueStore;
import org.opentripplanner.gtfs.mapping.DirectionMapper;
import org.opentripplanner.model.TripTimeOnDate;
Expand All @@ -56,7 +55,6 @@
import org.opentripplanner.routing.graphfinder.PatternAtStop;
import org.opentripplanner.routing.graphfinder.PlaceAtDistance;
import org.opentripplanner.routing.graphfinder.PlaceType;
import org.opentripplanner.routing.services.TransitAlertService;
import org.opentripplanner.routing.vehicle_parking.VehicleParking;
import org.opentripplanner.routing.vehicle_parking.VehicleParkingService;
import org.opentripplanner.service.vehiclerental.VehicleRentalService;
Expand Down Expand Up @@ -886,11 +884,7 @@ public DataFetcher<VehicleRentalStation> vehicleRentalStation() {
return vehicleRentalStationService
.getVehicleRentalStations()
.stream()
.filter(vehicleRentalStation ->
OTPFeature.GtfsGraphQlApiRentalStationFuzzyMatching.isOn()
? stationIdFuzzyMatches(vehicleRentalStation, id)
: stationIdMatches(vehicleRentalStation, id)
)
.filter(vehicleRentalStation -> stationIdMatches(vehicleRentalStation, id))
.findAny()
.orElse(null);
};
Expand Down Expand Up @@ -961,21 +955,6 @@ private boolean stationIdMatches(VehicleRentalStation station, String feedScoped
return station.getId().toString().equals(feedScopedId);
}

/**
* This matches station's feedScopedId to the given string if the string is feed scoped (i.e
* contains a `:` separator) or only matches the station's id without the feed to the given
* string. This approach can lead to a random station matching the criteria if there are multiple
* stations with the same id in different feeds.
* <p>
* TODO this can be potentially removed after a while, only used by Digitransit as of now.
*/
private boolean stationIdFuzzyMatches(VehicleRentalStation station, String idWithoutFeed) {
if (idWithoutFeed != null && idWithoutFeed.contains(":")) {
return stationIdMatches(station, idWithoutFeed);
}
return station.getId().getId().equals(idWithoutFeed);
}

private TransitService getTransitService(DataFetchingEnvironment environment) {
return environment.<GraphQLRequestContext>getContext().transitService();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,6 @@ public enum OTPFeature {
),
FloatingBike(true, false, "Enable floating bike routing."),
GtfsGraphQlApi(true, false, "Enable the [GTFS GraphQL API](apis/GTFS-GraphQL-API.md)."),
GtfsGraphQlApiRentalStationFuzzyMatching(
false,
false,
"Does vehicleRentalStation query also allow ids that are not feed scoped."
),
/**
* If this feature flag is switched on, then the minimum transfer time is not the minimum transfer
* time, but the definitive transfer time. Use this to override what we think the transfer will
Expand Down
Loading

0 comments on commit 8f2c146

Please sign in to comment.