lib/timescale/job_stats.rb in timescaledb-0.1.0 vs lib/timescale/job_stats.rb in timescaledb-0.1.2
- old
+ new
@@ -6,7 +6,13 @@
attribute :last_run_duration, :interval
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
end