Browse Source

Change back log address search method to only work for uprn selection

pull/2977/head
Manny Dinssa 2 months ago
parent
commit
827c7da173
  1. 10
      app/models/log.rb

10
app/models/log.rb

@ -128,8 +128,9 @@ class Log < ApplicationRecord
"#{address_line1_input}, #{postcode_full_input}" "#{address_line1_input}, #{postcode_full_input}"
end end
def address_options def address_search_options
if uprn.present? return if uprn.blank?
service = UprnClient.new(uprn) service = UprnClient.new(uprn)
service.call service.call
if service.result.blank? || service.error.present? if service.result.blank? || service.error.present?
@ -139,7 +140,9 @@ class Log < ApplicationRecord
presenter = UprnDataPresenter.new(service.result) presenter = UprnDataPresenter.new(service.result)
@address_options = [{ address: presenter.address, uprn: presenter.uprn }] @address_options = [{ address: presenter.address, uprn: presenter.uprn }]
else end
def address_options
return @address_options if @address_options && @last_searched_address_string == address_string return @address_options if @address_options && @last_searched_address_string == address_string
return if address_string.blank? return if address_string.blank?
@ -160,7 +163,6 @@ class Log < ApplicationRecord
@address_options = address_opts @address_options = address_opts
end end
end
def collection_start_year def collection_start_year
return @start_year if @start_year return @start_year if @start_year

Loading…
Cancel
Save