Class: GoodJob::PerformanceController

Inherits:
ApplicationController show all
Defined in:
app/controllers/good_job/performance_controller.rb

Instance Method Summary collapse

Instance Method Details

#indexObject



5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'app/controllers/good_job/performance_controller.rb', line 5

def index
  @performances = GoodJob::Execution
                  .where.not(job_class: nil)
                  .group(:job_class)
                  .select("
                        job_class,
                        COUNT(*) AS executions_count,
                        AVG(duration) AS avg_duration,
                        MIN(duration) AS min_duration,
                        MAX(duration) AS max_duration
                      ")
                  .order("job_class")
end

#showObject



19
20
21
22
# File 'app/controllers/good_job/performance_controller.rb', line 19

def show
  representative_job = GoodJob::Job.find_by!(job_class: params[:id])
  @job_class = representative_job.job_class
end