diff --git a/app/controllers/address_options_controller.rb b/app/controllers/address_options_controller.rb index e45a4ac6c..9e71f850a 100644 --- a/app/controllers/address_options_controller.rb +++ b/app/controllers/address_options_controller.rb @@ -10,7 +10,7 @@ class AddressOptionsController < ApplicationController if service.error.present? render json: { error: service.error }, status: :unprocessable_entity else - render json: service.result_by_uprn.map { |result| { address: result["ADDRESS"], uprn: result["UPRN"] } } + render json: [{ address: service.result["ADDRESS"], uprn: service.result["UPRN"] }] end elsif query.match?(/[a-zA-Z]/) # Query contains letters, assume it's an address @@ -30,7 +30,7 @@ class AddressOptionsController < ApplicationController address_service.call uprn_service.call - results = (address_service.result || []) + (uprn_service.result_by_uprn || []) + results = (address_service.result || []) + (uprn_service.result || []) if address_service.error.present? && uprn_service.error.present? render json: { error: "Address and UPRN are not recognised. Check the input." }, status: :unprocessable_entity