Class: MetricValue

Inherits:
ApplicationRecord show all
Defined in:
app/models/metric_value.rb

Overview

Metric value

Attributes:

metric_id [Metric]
time [DateTime]
quantity [Integer]

Instance Method Summary collapse

Instance Method Details

#time_for_graph(hours = 4) ⇒ Object

Parameters:

  • hours (Integer) (defaults to: 4)

    hour count per chunk



19
20
21
# File 'app/models/metric_value.rb', line 19

def time_for_graph(hours = 4)
  time - time.sec - time.min * 60 - (time.hour % hours * 3600) + hours.hours
end