Fix crash with budgets with no published phases
In this case, the duration of the budget cannot be determined, and the application was crashing when trying to do so. Now we're just returning `nil` as duration.
This commit is contained in:
@@ -10,7 +10,7 @@ class Admin::Budgets::DurationComponent < ApplicationComponent
|
||||
end
|
||||
|
||||
def duration
|
||||
distance_of_time_in_words(durable.starts_at, durable.ends_at)
|
||||
distance_of_time_in_words(durable.starts_at, durable.ends_at) if durable.starts_at && durable.ends_at
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
Reference in New Issue
Block a user