# frozen_string_literal: true
class Admin::Metrics::Measure::BaseMeasure
def self.with_params?
false
end
def initialize(start_at, end_at, params)
@start_at = start_at&.to_datetime
@end_at = end_at&.to_datetime
@params = params
def key
raise NotImplementedError
def total
def previous_total
def data
def self.model_name
self.class.name
def read_attribute_for_serialization(key)
send(key) if respond_to?(key)
protected
def time_period
(@start_at..@end_at)
def previous_time_period
((@start_at - length_of_period)..(@end_at - length_of_period))
def length_of_period
@length_of_period ||= @end_at - @start_at
def params