mirror of
https://github.com/mastodon/mastodon
synced 2024-12-21 18:18:13 +09:00
26 lines
671 B
Ruby
26 lines
671 B
Ruby
# frozen_string_literal: true
|
|
|
|
class Admin::Metrics::Measure::InteractionsMeasure < Admin::Metrics::Measure::BaseMeasure
|
|
def key
|
|
'interactions'
|
|
end
|
|
|
|
protected
|
|
|
|
def perform_total_query
|
|
activity_tracker.sum(time_period.first, time_period.last)
|
|
end
|
|
|
|
def perform_previous_total_query
|
|
activity_tracker.sum(previous_time_period.first, previous_time_period.last)
|
|
end
|
|
|
|
def perform_data_query
|
|
activity_tracker.get(time_period.first, time_period.last).map { |date, value| { date: date.to_time(:utc).iso8601, value: value.to_s } }
|
|
end
|
|
|
|
def activity_tracker
|
|
@activity_tracker ||= ActivityTracker.new('activity:interactions', :basic)
|
|
end
|
|
end
|