1
0

Displaying amount column in same format as quantities

This commit is contained in:
cryptogopher
2020-04-29 23:12:59 +02:00
parent da11c0f626
commit e74c707729
3 changed files with 11 additions and 4 deletions

View File

@@ -85,6 +85,9 @@ class MealsController < ApplicationController
foods = @project.meal_foods.compute_quantities(@quantities)
ingredients = @project.meal_ingredients
@amount_mfu_unit = ingredients
.each_with_object(Hash.new(0)) { |i, h| h[i.food.ref_unit] += 1 }.max_by(&:last).first
@nutrients = {}
@quantities.each do |q|
@nutrients[q] = ingredients.map do |i|