adds validation for price when investment is feasible
This commit is contained in:
@@ -25,6 +25,7 @@ class Budget
|
||||
validates :description, presence: true
|
||||
validates :heading_id, presence: true
|
||||
validates_presence_of :unfeasibility_explanation, if: :unfeasibility_explanation_required?
|
||||
validates_presence_of :price, if: :price_required?
|
||||
|
||||
validates :title, length: { in: 4..Budget::Investment.title_max_length }
|
||||
validates :description, length: { maximum: Budget::Investment.description_max_length }
|
||||
@@ -136,6 +137,10 @@ class Budget
|
||||
unfeasible? && valuation_finished?
|
||||
end
|
||||
|
||||
def price_required?
|
||||
feasible? && valuation_finished?
|
||||
end
|
||||
|
||||
def unfeasible_email_pending?
|
||||
unfeasible_email_sent_at.blank? && unfeasible? && valuation_finished?
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user