Sha256: 63dc93540f3e78f968380abf0945dcb514d28a014b692fc200b0ed42d642f069

Contents?: true

Size: 499 Bytes

Versions: 1

Compression:

Stored size: 499 Bytes

Contents

module Que::Web::Viewmodels
  class Dashboard
    attr_reader :running, :scheduled, :failing
    def initialize(job_stats, failing_count)
      @running = calculate_running(job_stats)
      @scheduled = calculate_scheduled(job_stats)
      @failing = failing_count
    end


    private

    def calculate_running(job_stats)
      job_stats.map{|s| s["count_working"]}.reduce(0, :+)
    end

    def calculate_scheduled(job_stats)
      job_stats.map{|s| s["count"]}.reduce(0, :+)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
que-web-0.1.0 lib/que/web/viewmodels/dashboard.rb