You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In #83 we added the ability to disambiguate stop numbers within the same region. For example, in Tampa, stop 3105 maps to two stops. The OBA skill will now iterate through the stops by name and ask you if it's the right one.
I'd like to add the agency name(s) serving that stop when iterating through them. Reasoning is that most duplicate stop codes arise from one stop code per agency, and the user will likely know which agency they want, but may not recognize the stop names.
I believe you'll need to refactor ObaUserClient.getStopFromCode() to return the ObaStopsForLocationResponse instead of just the array of stops. You can then get the route IDs for each stop, and for each route ID get the agency ID for that route and then the agency name for each agency ID. A stop in OBA can serve more than one agency, which is why this is a little convoluted.
Code should look something like this:
ObaStop stop = getObaStop(); // Get a reference to a ObaStop - this will be a loop for you, likely getting all stops from response.getStops();
String[] routeIds = stop.getRouteIds();
Set<String> agencyIds = new HashSet<>();
for (int i = 0; i < routeIds.length; i++) {
agencyIds.add(agencyIds[i]);
}
Set<String> agencyNames = new HashSet<>();
for (String agencyId : agencyIds) {
agencyNames.add(response.getAgency(agencyId).getName());
}
// agencyNames should now contain all the agency names (one or more) that have routes that visit this stop
I'd probably put the above in a utility method.
Steps to reproduce:
"Alexa, set my city to Tampa"
"3105" // Stop number
Expected behavior:
Tell me the agency names that serve each stop, when asking me if its the right stop
Summary:
In #83 we added the ability to disambiguate stop numbers within the same region. For example, in Tampa, stop 3105 maps to two stops. The OBA skill will now iterate through the stops by name and ask you if it's the right one.
I'd like to add the agency name(s) serving that stop when iterating through them. Reasoning is that most duplicate stop codes arise from one stop code per agency, and the user will likely know which agency they want, but may not recognize the stop names.
My comments from #53 (comment):
Steps to reproduce:
Expected behavior:
Tell me the agency names that serve each stop, when asking me if its the right stop
Observed behavior:
Only the stop names are read
Device:
Amazon Echo
cc @vikram31291
The text was updated successfully, but these errors were encountered: