Sha256: dd323b4777b74f581d80a7bfbb5e1f2ad544b8744d4f694fe82000585971a080

Contents?: true

Size: 790 Bytes

Versions: 1

Compression:

Stored size: 790 Bytes

Contents

# frozen_string_literal: true

module GoodJob
  class PerformanceController < ApplicationController
    def index
      @performances = GoodJob::DiscreteExecution
                      .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

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
good_job-4.1.0 app/controllers/good_job/performance_controller.rb