Fix Valuation Investment index heading filters

Why:

Heading filter where not being correctly displayed

How:

Increasing scenario to cover all possible combinations, and fixing the
heading_filters method of the Valuation Budget Investment Controller to
correctly:
  * Find how many investments the valuator can access
  * Count investments for each heading
This commit is contained in:
Bertocq
2018-03-13 19:58:40 +01:00
committed by decabeza
parent 06831f4fc9
commit 3e75bd4dfd
2 changed files with 21 additions and 19 deletions

View File

@@ -73,7 +73,9 @@ class Valuation::BudgetInvestmentsController < Valuation::BaseController
end
def heading_filters
investments = @budget.investments.by_valuator(current_user.valuator.try(:id)).distinct
investments = @budget.investments.by_valuator(current_user.valuator.try(:id))
.visible_to_valuators.distinct
investment_headings = Budget::Heading.where(id: investments.pluck(:heading_id).uniq)
.order(name: :asc)