Browse Source

Memoise empty address options result

pull/2675/head
Kat 2 years ago
parent
commit
9e185afa50
  1. 5
      app/models/log.rb

5
app/models/log.rb

@ -130,7 +130,10 @@ class Log < ApplicationRecord
if [address_line1_input, postcode_full_input].all?(&:present?) if [address_line1_input, postcode_full_input].all?(&:present?)
service = AddressClient.new(address_string) service = AddressClient.new(address_string)
service.call service.call
return nil if service.result.blank? || service.error.present? if service.result.blank? || service.error.present?
@address_options = []
return @answer_options
end
address_opts = [] address_opts = []
service.result.first(10).each do |result| service.result.first(10).each do |result|

Loading…
Cancel
Save