Sha256: 995e8c6e945a022f5391b4ddb7852851c837d971987fda0123aec853a8e9f8f8

Contents?: true

Size: 968 Bytes

Versions: 29

Compression:

Stored size: 968 Bytes

Contents

class Pyk::Dj
  
  #Pyk::Dj.bug
  def self.bug
    DelayedJob.where("last_error is not null")
  end
  
  #Pyk::Dj.ok
  def self.ok
    DelayedJob.where("last_error is null")
  end
  
  #Pyk::Dj.active
  def self.active
    DelayedJob.where("locked_at is not null")
  end
  
  #Pyk::Dj.bug_count
  def self.bug_count
    DelayedJob.where("last_error is not null").count
  end
  
  #Pyk::Dj.ok_count
  def self.ok_count
    DelayedJob.where("last_error is null").count
  end
  
  #Pyk::Dj.active_count
  def self.active_count
    DelayedJob.where("locked_at is not null").count
  end
  
  #Pyk::Dj.status(d)
  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
  
end

Version data entries

29 entries across 29 versions & 1 rubygems

Version Path
pyk-0.1.0 lib/pyk/dj.rb
pyk-0.0.9 lib/pyk/dj.rb
pyk-0.0.8 lib/pyk/dj.rb
pyk-0.0.7 lib/pyk/dj.rb
pyk-0.0.6 lib/pyk/dj.rb
pyk-0.0.5 lib/pyk/dj.rb
pyk-0.0.3 lib/pyk/dj.rb
pyk-0.0.2 lib/pyk/dj.rb
pyk-0.0.1 lib/pyk/dj.rb