prints the right value in budgets table

This commit is contained in:
kikito
2017-01-04 18:48:01 +01:00
parent 0835a7aba6
commit 635de83f86
4 changed files with 11 additions and 5 deletions

View File

@@ -6,6 +6,12 @@ class Valuation::BudgetsController < Valuation::BaseController
def index def index
@budgets = @budgets.current.order(created_at: :desc).page(params[:page]) @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
end end

View File

@@ -7,7 +7,7 @@
<tr> <tr>
<th><%= t("valuation.budgets.index.table_name") %></th> <th><%= t("valuation.budgets.index.table_name") %></th>
<th><%= t("valuation.budgets.index.table_phase") %></th> <th><%= t("valuation.budgets.index.table_phase") %></th>
<th><%= t("valuation.budgets.index.table_assigned_headings") %></th> <th><%= t("valuation.budgets.index.table_assigned_investments_valuation_open") %></th>
<th><%= t("valuation.budgets.index.table_actions") %></th> <th><%= t("valuation.budgets.index.table_actions") %></th>
</tr> </tr>
</thead> </thead>
@@ -21,7 +21,7 @@
<%= t("budget.phase.#{budget.phase}") %> <%= t("budget.phase.#{budget.phase}") %>
</td> </td>
<td> <td>
3 partidas <%= @investments_with_valuation_open[budget.id] %>
</td> </td>
<td> <td>
<%= link_to t("valuation.budgets.index.evaluate"), <%= link_to t("valuation.budgets.index.evaluate"),

View File

@@ -13,7 +13,7 @@ en:
finished: Finished finished: Finished
table_name: Name table_name: Name
table_phase: Phase table_phase: Phase
table_assigned_headings: Assigned headings table_assigned_investments_valuation_open: Investment projects assigned with valuation open
table_actions: Actions table_actions: Actions
evaluate: Evaluate evaluate: Evaluate
budget_investments: budget_investments:

View File

@@ -13,7 +13,7 @@ es:
finished: Terminados finished: Terminados
table_name: Nombre table_name: Nombre
table_phase: Fase table_phase: Fase
table_assigned_headings: Partidas asignadas table_assigned_investments_valuation_open: Prop. Inv. asignadas en evaluación
table_actions: Acciones table_actions: Acciones
evaluate: Evaluar evaluate: Evaluar
budget_investments: budget_investments: