It has more sense to show the count of the investments the valuator is going to find in the investments valuation page.
17 lines
388 B
Ruby
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
|