Files
nairobi/app/components/valuation/budgets/row_component.rb
Javi Martín ed4b03c3ed Show link to evaluate after evaluation has finished
This way it's still possible to access the "evaluation finished" filter
in the valuation investments index.
2023-02-17 15:26:49 +01:00

23 lines
514 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
return Budget::Investment.none unless budget.valuating_or_later?
budget.investments.visible_to_valuators.by_valuator(current_user.valuator)
end
def valuation_open_investments_count
return 0 unless budget.valuating?
investments.valuation_open.count
end
end