Sha256: f20a88072356a8525173f07ee43291e21a8ce8ea1368587a7271175173d4b250

Contents?: true

Size: 529 Bytes

Versions: 3

Compression:

Stored size: 529 Bytes

Contents

module Timescaledb
  class JobStat < ActiveRecord::Base
    self.table_name = "timescaledb_information.job_stats"

    belongs_to :job

    scope :success, -> { where(last_run_status: "Success") }
    scope :scheduled, -> { where(job_status: "Scheduled") }
    scope :resume, -> do
      select("sum(total_successes)::int as success,
             sum(total_runs)::int as runs,
             sum(total_failures)::int as failures")
        .to_a.map{|e|e.attributes.transform_keys(&:to_sym) }
    end
  end
  JobStats = JobStat
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
timescaledb-0.2.2 lib/timescaledb/job_stats.rb
timescaledb-0.2.1 lib/timescaledb/job_stats.rb
timescaledb-0.2.0 lib/timescaledb/job_stats.rb