Files
nairobi/app/components/valuation/budgets/row_component.rb
Senén Rodero Rodríguez 615b249144 Count only the investments visible and assigned to current valuator
It has more sense to show the count of the investments the
valuator is going to find in the investments valuation page.
2023-02-03 11:01:41 +01:00

17 lines
388 B
Ruby

class Valuation::Budgets::RowComponent < ApplicationComponent
attr_reader :budget
with_collection_parameter :budget
delegate :current_user, to: :helpers
def initialize(budget:)
@budget = budget
end
def investments_count
return 0 unless budget.valuating?
budget.investments.visible_to_valuators.by_valuator(current_user.valuator).valuation_open.count
end
end