Sha256: 7b00c82b4c83838c5d6678a9507570fae80e51f1ef25feeed28c2641db55013b
Contents?: true
Size: 1.02 KB
Versions: 1
Compression:
Stored size: 1.02 KB
Contents
# frozen_string_literal: true module GoodJob class ExecutionsFilter < BaseFilter def states { 'finished' => base_query.finished.count, 'unfinished' => base_query.unfinished.count, 'running' => base_query.running.count, 'errors' => base_query.where.not(error: nil).count, } end def filtered_query query = base_query query = query.job_class(params[:job_class]) if params[:job_class].present? query = query.where(queue_name: params[:queue_name]) if params[:queue_name].present? query = query.search(params['query']) if params[:query].present? if params[:state] case params[:state] when 'finished' query = query.finished when 'unfinished' query = query.unfinished when 'running' query = query.running when 'errors' query = query.where.not(error: nil) end end query end private def default_base_query GoodJob::Execution.all end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
good_job-2.6.1 | engine/app/filters/good_job/executions_filter.rb |