Class: SolidStackWeb::ThroughputSparkline
- Inherits:
-
Object
- Object
- SolidStackWeb::ThroughputSparkline
- Defined in:
- app/models/solid_stack_web/throughput_sparkline.rb
Constant Summary collapse
- HOURS =
12
Instance Method Summary collapse
Instance Method Details
#buckets ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'app/models/solid_stack_web/throughput_sparkline.rb', line 5 def buckets @buckets ||= begin now = Time.current origin = now - HOURS.hours times = ::SolidQueue::Job.where(finished_at: origin..now).pluck(:finished_at) HOURS.times.map do |i| from = origin + i.hours to = origin + (i + 1).hours times.count { |t| t >= from && t < to } end end end |
#max ⇒ Object
19 20 21 |
# File 'app/models/solid_stack_web/throughput_sparkline.rb', line 19 def max buckets.max || 0 end |