Files
nairobi/app/components/budgets/ballot/ballot_component.rb
Javi Martín 9f94e95689 Extract methods in ballot component
Assigning variables in the view makes the code harder to read.
2021-10-29 15:23:22 +02:00

22 lines
339 B
Ruby

class Budgets::Ballot::BallotComponent < ApplicationComponent
attr_reader :ballot
def initialize(ballot)
@ballot = ballot
end
def budget
ballot.budget
end
private
def ballot_groups
ballot.groups.sort_by_name
end
def no_balloted_groups
budget.groups.sort_by_name - ballot.groups
end
end