Sha256: c0d39ef0951c1925ddf86a531c86cff7e8090ddb9fd65dd1b78949f00ec35a6e

Contents?: true

Size: 783 Bytes

Versions: 1

Compression:

Stored size: 783 Bytes

Contents

# frozen_string_literal: true

module GoodJob
  class MetricsController < ApplicationController
    def primary_nav
      jobs_count = GoodJob::Job.count
      batches_count = GoodJob::BatchRecord.migrated? ? GoodJob::BatchRecord.all.size : 0
      cron_entries_count = GoodJob::CronEntry.all.size
      processes_count = GoodJob::Process.active.count

      render json: {
        jobs_count: number_to_human(jobs_count),
        batches_count: number_to_human(batches_count),
        cron_entries_count: number_to_human(cron_entries_count),
        processes_count: number_to_human(processes_count),
      }
    end

    private

    def number_to_human(count)
      helpers.number_to_human(count, **helpers.translate_hash("good_job.number.human.decimal_units"))
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
good_job-3.26.2 app/controllers/good_job/metrics_controller.rb