Class: SolidQueueWeb::HistoryController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- SolidQueueWeb::HistoryController
- Defined in:
- app/controllers/solid_queue_web/history_controller.rb
Constant Summary
Constants inherited from ApplicationController
ApplicationController::PERIOD_DURATIONS
Instance Method Summary collapse
Instance Method Details
#index ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 |
# File 'app/controllers/solid_queue_web/history_controller.rb', line 3 def index @queue = params[:queue].presence @search = params[:q].presence @period = params[:period].presence_in(PERIOD_DURATIONS.keys) scope = SolidQueue::Job.where.not(finished_at: nil) scope = scope.where(queue_name: @queue) if @queue.present? scope = scope.where("class_name LIKE ?", "%#{@search}%") if @search.present? scope = scope.where("finished_at >= ?", PERIOD_DURATIONS[@period].ago) if @period.present? @pagy, @jobs = pagy(scope.order(finished_at: :desc)) end |