Skip to content

Commit

Permalink
Merge pull request #6282 from HSLdevcom/remove-rental-fuzzy-mapping
Browse files Browse the repository at this point in the history
Remove unused GtfsGraphQlApiRentalStationFuzzyMatching feature
  • Loading branch information
optionsome authored Dec 5, 2024
2 parents 2050217 + 7d29c1d commit 0ce1067
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 60 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 Down Expand Up @@ -893,11 +892,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 @@ -968,21 +963,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 0ce1067

Please sign in to comment.