app/models/foreman_tasks/task.rb in foreman-tasks-5.0.0 vs app/models/foreman_tasks/task.rb in foreman-tasks-5.1.0
- old
+ new
@@ -76,9 +76,10 @@
(lambda do |resource|
joins(:links).where(:"foreman_tasks_links.resource_id" => resource.id,
:"foreman_tasks_links.resource_type" => resource.class.name)
end)
scope :for_action_types, (->(action_types) { where('foreman_tasks_tasks.label IN (?)', Array(action_types)) })
+ scope :with_duration, -> { select("foreman_tasks_tasks.*, coalesce(ended_at, current_timestamp) - coalesce(coalesce(started_at, ended_at), current_timestamp) as duration") }
apipie :class, "A class representing #{model_name.human} object" do
name 'Task'
refs 'Task'
sections only: %w[all additional]