Class: GoodJob::BatchesFilter

Inherits:
BaseFilter show all
Defined in:
app/filters/good_job/batches_filter.rb

Constant Summary

Constants inherited from BaseFilter

GoodJob::BaseFilter::DEFAULT_LIMIT, GoodJob::BaseFilter::EMPTY

Instance Attribute Summary

Attributes inherited from BaseFilter

#base_query, #params

Instance Method Summary collapse

Methods inherited from BaseFilter

#filtered_count, #initialize, #job_classes, #last, #queues, #state_names, #states, #to_params

Constructor Details

This class inherits a constructor from GoodJob::BaseFilter

Instance Method Details

#default_base_queryObject



18
19
20
# File 'app/filters/good_job/batches_filter.rb', line 18

def default_base_query
  GoodJob::BatchRecord.includes(:jobs)
end

#filtered_query(_filtered_params = params) ⇒ Object



14
15
16
# File 'app/filters/good_job/batches_filter.rb', line 14

def filtered_query(_filtered_params = params)
  base_query
end

#recordsObject



5
6
7
8
9
10
11
12
# File 'app/filters/good_job/batches_filter.rb', line 5

def records
  after_created_at = params[:after_created_at].present? ? Time.zone.parse(params[:after_created_at]) : nil

  filtered_query.display_all(
    after_created_at: after_created_at,
    after_id: params[:after_id]
  ).limit(params.fetch(:limit, DEFAULT_LIMIT))
end