Commit 624d235992bbf8db1f6736b1a8e8dbe82f41e0a5

Authored by Rafael Martins
1 parent 644913c2

Fix for solidarity economy percentage on product search view

app/models/product.rb
@@ -125,7 +125,6 @@ class Product < ActiveRecord::Base @@ -125,7 +125,6 @@ class Product < ActiveRecord::Base
125 end 125 end
126 end 126 end
127 127
128 - # Note: will probably be completely overhauled for AI1413  
129 def inputs_prices? 128 def inputs_prices?
130 return false if self.inputs.count <= 0 129 return false if self.inputs.count <= 0
131 self.inputs.each do |input| 130 self.inputs.each do |input|
app/views/search/_product.rhtml
@@ -23,10 +23,10 @@ @@ -23,10 +23,10 @@
23 <% product.inputs.each{ |i| t_i += 1; se_i += 1 if i.is_from_solidarity_economy } %> 23 <% product.inputs.each{ |i| t_i += 1; se_i += 1 if i.is_from_solidarity_economy } %>
24 <% p = case (se_i.to_f/t_i)*100 24 <% p = case (se_i.to_f/t_i)*100
25 when 0..24.999 then ["0", _("")]; 25 when 0..24.999 then ["0", _("")];
26 - when 25..49.999 then ["0", _("25%")];  
27 - when 50..74.999 then ["25", _("50%")];  
28 - when 75..99.999 then ["50", _("75%")];  
29 - when 100 then ["75", _("100%")]; 26 + when 25..49.999 then ["25", _("25%")];
  27 + when 50..74.999 then ["50", _("50%")];
  28 + when 75..99.999 then ["75", _("75%")];
  29 + when 100 then ["100", _("100%")];
30 end %> 30 end %>
31 <div class="search-product-percentage-from-solidarity-economy search-product-ecosol-percentage-icon-<%=p[0]%>" title="<%=_('Percentage of inputs from solidarity economy')%>"> 31 <div class="search-product-percentage-from-solidarity-economy search-product-ecosol-percentage-icon-<%=p[0]%>" title="<%=_('Percentage of inputs from solidarity economy')%>">
32 <%= p[1] %> 32 <%= p[1] %>