Browse Source

feat: add match colouring for ease of use

CLDC-3233-address-uprn-lookup-spike
natdeanlewissoftwire 11 months ago
parent
commit
a81e6351c8
  1. 13
      app/helpers/uprn_address_spike_helper.rb
  2. 2
      app/views/content/uprn_address_spike.html.erb

13
app/helpers/uprn_address_spike_helper.rb

@ -0,0 +1,13 @@
# frozen_string_literal: true
module UprnAddressSpikeHelper
def match_colour(match)
if match >= 0.8
"green"
elsif match >= 0.7
"orange"
else
"red"
end
end
end

2
app/views/content/uprn_address_spike.html.erb

@ -32,7 +32,7 @@
<% @addresses_returned.each do |address_returned| %>
<p>Address: <%= address_returned.address %></p>
<p>UPRN: <%= address_returned.uprn %></p>
<p>Confidence: <%= address_returned.match%> (<%= address_returned.match_description %>)</p>
<p>Confidence: <span style="color:<%= match_colour(address_returned.match) %>"><%= address_returned.match%> (<%= address_returned.match_description %>)</span></p>
<br>
<% end %>
<% end %>

Loading…
Cancel
Save