Sha256: 1199b229777f4b72661082af3c2351285d5cd474590d562b7f46734c3d3c6e84

Contents?: true

Size: 787 Bytes

Versions: 4

Compression:

Stored size: 787 Bytes

Contents

class QueuePage < Page
  respond_to :get do
    with :html do
      @task_count = site.tasks.count
      @delayed_task_count = site.tasks.where(due: {'$ne' => nil}, attempts: 0).count
      @instant_task_count = site.tasks.where(due: nil).count
      @failed_tasks = site.tasks.where(attempts: {'$gt' => 0}).all
      
      render_or_default(:html) do
        "<p>Sorry, a layout couldn't be found for this page</p>" # FIXME: better error message
      end
    end
  end
  
  respond_to :post do
    with :html do
      task = site.tasks.find(BSON::ObjectId.from_string(params['id']))
      if task
        task.due = nil
        task.locked = nil
        task.attempts = 0
        task.stack_trace = nil
        task.save
      end
      response.redirect(self.path)
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
yodel_queue-0.0.7 lib/models/queue_page.rb
yodel_queue-0.0.4 lib/models/queue_page.rb
yodel_queue-0.0.2 lib/models/queue_page.rb
yodel_queue-0.0.1 lib/models/queue_page.rb