compute_quantities: allow indirect associations and model dependencies
This commit is contained in:
@@ -27,7 +27,7 @@
|
||||
<tr class="header">
|
||||
<td class="quantityhead"><%= "[#{@amount_mfu_unit.shortname}]" %></td>
|
||||
<% @quantities.each do |q| %>
|
||||
<% mfu_unit = @nutrients[q][:mfu_unit] %>
|
||||
<% mfu_unit = @ingredient_summary[:mfu_unit][q] %>
|
||||
<td class="quantityhead"><%= "[#{mfu_unit ? mfu_unit.shortname : '-'}]" %></td>
|
||||
<% end %>
|
||||
</tr>
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
<td class="value ellipsible" style="border-left: none;"></td>
|
||||
<% @quantities.each do |q| %>
|
||||
<td class="value ellipsible">
|
||||
<%= format_value(@nutrient_summary[q][m], @nutrients[q][:precision]) %>
|
||||
<%= format_value(@ingredient_summary[m][q], @ingredient_summary[:precision][q]) %>
|
||||
</td>
|
||||
<% end %>
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<td class="value ellipsible" style="border-left: none;"></td>
|
||||
<% @quantities.each do |q| %>
|
||||
<td class="value ellipsible">
|
||||
<%= format_value(@nutrient_summary[q][date], @nutrients[q][:precision]) %>
|
||||
<%= format_value(@ingredient_summary[date][q], @ingredient_summary[:precision][q]) %>
|
||||
</td>
|
||||
<% end %>
|
||||
<td></td>
|
||||
|
||||
@@ -6,7 +6,8 @@
|
||||
</td>
|
||||
<% @quantities.each do |q| %>
|
||||
<td class="value ellipsible">
|
||||
<%= format_value(*@nutrients[q].values_at(i, :precision, :mfu_unit)) %>
|
||||
<%= format_value(@ingredients[i][q], @ingredient_summary[:precision][q],
|
||||
@ingredient_summary[:mfu_unit][q]) %>
|
||||
</td>
|
||||
<% end %>
|
||||
<td class="action unwrappable" style="width: 1%; text-align: right;">
|
||||
|
||||
Reference in New Issue
Block a user