Refactor Budget publishing prices phases constant to Budget::Phase model

This commit is contained in:
Bertocq
2018-01-15 20:20:10 +01:00
parent 66691b644a
commit ca3d759d9f
4 changed files with 8 additions and 9 deletions

View File

@@ -3,8 +3,6 @@ class Budget < ActiveRecord::Base
include Measurable
include Sluggable
PUBLISHED_PRICES_PHASES = %w(publishing_prices balloting reviewing_ballots finished).freeze
CURRENCY_SYMBOLS = %w(€ $ £ ¥).freeze
validates :name, presence: true, uniqueness: true
@@ -80,7 +78,7 @@ class Budget < ActiveRecord::Base
end
def published_prices?
PUBLISHED_PRICES_PHASES.include?(phase)
Budget::Phase::PUBLISHED_PRICES_PHASES.include?(phase)
end
def balloting_process?

View File

@@ -2,6 +2,7 @@ class Budget
class Phase < ActiveRecord::Base
PHASE_KINDS = %w(drafting accepting reviewing selecting valuating publishing_prices balloting
reviewing_ballots finished).freeze
PUBLISHED_PRICES_PHASES = %w(publishing_prices balloting reviewing_ballots finished).freeze
DESCRIPTION_MAX_LENGTH = 2000
belongs_to :budget