Skip to content

Commit

Permalink
Fix bug that created a location error for multiple authorities
Browse files Browse the repository at this point in the history
This line was creating a location error when the search result contained multiple authorities. You could see this on live on the multiple authorities search result page page title eg. "Error: Find a Disabled Students' Allowance assessment provider - GOV.UK"

This PR already adds the correct page title for search result pages, but the location error would still get appended to that eg. "Find a Disabled Students' Allowance assessment provider: select an address - GOV.UKError: Find a Disabled Students' Allowance assessment provider - GOV.UK"

The check added in this commit is the same as the check on line 17 to check if the multiple authorities template should be rendered (that line also checks if postcode is provided, but we already check for that on line 55 here).

However, I'm not sure if my "fix" is the best way to handle this or if bypassing multiple authorities in this way could be introducing some other issue. Maybe we should why the places_not_found method from the model doesn't recognise multiple authorities as a valid result. I've tried to superficially compare how this is handled for the other postcode finders like local transaction but those use the location_api model instead.
  • Loading branch information
hannalaakso committed May 20, 2024
1 parent 58ac338 commit bb9c569
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion app/controllers/place_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def location_error
return LocationError.new(INVALID_POSTCODE) unless postcode_provided?
return LocationError.new(INVALID_POSTCODE) if places_manager_response.invalid_postcode?

LocationError.new(NO_LOCATION) if places_manager_response.places_not_found?
LocationError.new(NO_LOCATION) if places_manager_response.places_not_found? && !places_manager_response.addresses_returned?
end

def places_manager_response
Expand Down

0 comments on commit bb9c569

Please sign in to comment.