Skip to content

Commit 40773eb

Browse files
committed
Helper status method
1 parent 908cee4 commit 40773eb

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

app/models/solid_queue/batch/trackable.rb

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,16 @@ module Trackable
1212
scope :failed, -> { where.not(failed_at: nil) }
1313
end
1414

15+
def status
16+
if finished?
17+
failed? ? "failed" : "completed"
18+
elsif enqueued_at.present?
19+
"processing"
20+
else
21+
"pending"
22+
end
23+
end
24+
1525
def failed?
1626
failed_at.present?
1727
end

0 commit comments

Comments
 (0)