Commit 8f42ea6fdc629a43195adc4b367b2b3115b7d152
1 parent
5ad46e23
Exists in
master
and in
29 other branches
Calling method instead of calculating cost on view
(ActionItem2111)
Showing
2 changed files
with
1 additions
and
6 deletions
Show diff stats
app/models/input.rb
@@ -59,9 +59,4 @@ class Input < ActiveRecord::Base | @@ -59,9 +59,4 @@ class Input < ActiveRecord::Base | ||
59 | return 0 if self.amount_used.blank? || self.price_per_unit.blank? | 59 | return 0 if self.amount_used.blank? || self.price_per_unit.blank? |
60 | self.amount_used * self.price_per_unit | 60 | self.amount_used * self.price_per_unit |
61 | end | 61 | end |
62 | - | ||
63 | - def cost | ||
64 | - return 0 if self.amount_used.blank? || self.price_per_unit.blank? | ||
65 | - self.amount_used * self.price_per_unit | ||
66 | - end | ||
67 | end | 62 | end |
app/views/catalog/index.rhtml
@@ -59,7 +59,7 @@ | @@ -59,7 +59,7 @@ | ||
59 | <% product.inputs.each do |i| %> | 59 | <% product.inputs.each do |i| %> |
60 | <div class="search-product-input-dots-to-price"> | 60 | <div class="search-product-input-dots-to-price"> |
61 | <div class="search-product-input-name"><%= i.product_category.name %></div> | 61 | <div class="search-product-input-name"><%= i.product_category.name %></div> |
62 | - <%= price_span i.price_per_unit * i.amount_used, :class => 'search-product-input-price' %> | 62 | + <%= price_span i.cost, :class => 'search-product-input-price' %> |
63 | </div> | 63 | </div> |
64 | <% end %> | 64 | <% end %> |
65 | </div> | 65 | </div> |