From 635de83f866eda6d97604764fef4c004c9e7d19c Mon Sep 17 00:00:00 2001 From: kikito Date: Wed, 4 Jan 2017 18:48:01 +0100 Subject: [PATCH] prints the right value in budgets table --- app/controllers/valuation/budgets_controller.rb | 8 +++++++- app/views/valuation/budgets/index.html.erb | 4 ++-- config/locales/valuation.en.yml | 2 +- config/locales/valuation.es.yml | 2 +- 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/app/controllers/valuation/budgets_controller.rb b/app/controllers/valuation/budgets_controller.rb index 0b7efe858..744b0d4bf 100644 --- a/app/controllers/valuation/budgets_controller.rb +++ b/app/controllers/valuation/budgets_controller.rb @@ -6,6 +6,12 @@ class Valuation::BudgetsController < Valuation::BaseController def index @budgets = @budgets.current.order(created_at: :desc).page(params[:page]) + @investments_with_valuation_open = {} + @budgets.each do |b| + @investments_with_valuation_open[b.id] = b.investments + .by_valuator(current_user.valuator.try(:id)) + .valuation_open + .count + end end - end diff --git a/app/views/valuation/budgets/index.html.erb b/app/views/valuation/budgets/index.html.erb index 4f2b7ffa6..5df21fc3e 100644 --- a/app/views/valuation/budgets/index.html.erb +++ b/app/views/valuation/budgets/index.html.erb @@ -7,7 +7,7 @@ <%= t("valuation.budgets.index.table_name") %> <%= t("valuation.budgets.index.table_phase") %> - <%= t("valuation.budgets.index.table_assigned_headings") %> + <%= t("valuation.budgets.index.table_assigned_investments_valuation_open") %> <%= t("valuation.budgets.index.table_actions") %> @@ -21,7 +21,7 @@ <%= t("budget.phase.#{budget.phase}") %> - 3 partidas + <%= @investments_with_valuation_open[budget.id] %> <%= link_to t("valuation.budgets.index.evaluate"), diff --git a/config/locales/valuation.en.yml b/config/locales/valuation.en.yml index b28446a77..de19fea09 100644 --- a/config/locales/valuation.en.yml +++ b/config/locales/valuation.en.yml @@ -13,7 +13,7 @@ en: finished: Finished table_name: Name table_phase: Phase - table_assigned_headings: Assigned headings + table_assigned_investments_valuation_open: Investment projects assigned with valuation open table_actions: Actions evaluate: Evaluate budget_investments: diff --git a/config/locales/valuation.es.yml b/config/locales/valuation.es.yml index b8a9d6a3f..b588c8521 100644 --- a/config/locales/valuation.es.yml +++ b/config/locales/valuation.es.yml @@ -13,7 +13,7 @@ es: finished: Terminados table_name: Nombre table_phase: Fase - table_assigned_headings: Partidas asignadas + table_assigned_investments_valuation_open: Prop. Inv. asignadas en evaluación table_actions: Acciones evaluate: Evaluar budget_investments: