Class: Pyk::Dj

Inherits:
Object
  • Object
show all
Defined in:
lib/pyk/dj.rb

Class Method Summary collapse

Class Method Details

.activeObject

Pyk::Dj.active



14
15
16
# File 'lib/pyk/dj.rb', line 14

def self.active
  DelayedJob.where("locked_at is not null")
end

.active_countObject

Pyk::Dj.active_count



29
30
31
# File 'lib/pyk/dj.rb', line 29

def self.active_count
  DelayedJob.where("locked_at is not null").count
end

.bugObject

Pyk::Dj.bug



4
5
6
# File 'lib/pyk/dj.rb', line 4

def self.bug
  DelayedJob.where("last_error is not null")
end

.bug_countObject

Pyk::Dj.bug_count



19
20
21
# File 'lib/pyk/dj.rb', line 19

def self.bug_count
  DelayedJob.where("last_error is not null").count
end

.okObject

Pyk::Dj.ok



9
10
11
# File 'lib/pyk/dj.rb', line 9

def self.ok
  DelayedJob.where("last_error is null")
end

.ok_countObject

Pyk::Dj.ok_count



24
25
26
# File 'lib/pyk/dj.rb', line 24

def self.ok_count
  DelayedJob.where("last_error is null").count
end

.status(d) ⇒ Object

Pyk::Dj.status(d)



34
35
36
37
38
39
40
41
42
# File 'lib/pyk/dj.rb', line 34

def self.status(d)
  if !d.last_error.blank?
    return "<span class='red'>Error</span>".html_safe
  elsif d.last_error.blank? and d.locked_at.blank?
    return "<span style='color: orange;'>In Queue</span>".html_safe
  elsif d.last_error.blank? and !d.locked_at.blank?
    return "<span class='green'>Running</span>".html_safe
  end
end