diff --git a/app/models/budget.rb b/app/models/budget.rb index ce8bc4dfa..509352372 100644 --- a/app/models/budget.rb +++ b/app/models/budget.rb @@ -5,6 +5,8 @@ class Budget < ActiveRecord::Base PHASES = %w(drafting accepting reviewing selecting valuating balloting reviewing_ballots finished).freeze + ON_HOLD_PHASES = %w(reviewing valuating reviewing_ballots).freeze + CURRENCY_SYMBOLS = %w(€ $ £ ¥).freeze validates :name, presence: true, uniqueness: true @@ -19,17 +21,17 @@ class Budget < ActiveRecord::Base before_validation :sanitize_descriptions - scope :on_hold, -> { where(phase: %w(reviewing valuating reviewing_ballots")) } - scope :drafting, -> { where(phase: "drafting") } + scope :on_hold, -> { where(phase: ON_HOLD_PHASES) } + scope :drafting, -> { where(phase: "drafting") } scope :accepting, -> { where(phase: "accepting") } scope :reviewing, -> { where(phase: "reviewing") } scope :selecting, -> { where(phase: "selecting") } scope :valuating, -> { where(phase: "valuating") } scope :balloting, -> { where(phase: "balloting") } scope :reviewing_ballots, -> { where(phase: "reviewing_ballots") } - scope :finished, -> { where(phase: "finished") } + scope :finished, -> { where(phase: "finished") } - scope :current, -> { where.not(phase: "finished") } + scope :current, -> { where.not(phase: "finished") } def description send("description_#{phase}").try(:html_safe) @@ -84,7 +86,7 @@ class Budget < ActiveRecord::Base end def on_hold? - reviewing? || valuating? || reviewing_ballots? + ON_HOLD_PHASES.include?(phase) end def current?