2021-10-14 18:44:59 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
class Admin::Metrics::Measure
|
|
|
|
MEASURES = {
|
2024-03-11 09:16:19 +00:00
|
|
|
active_users: ActiveUsersMeasure,
|
|
|
|
new_users: NewUsersMeasure,
|
|
|
|
interactions: InteractionsMeasure,
|
|
|
|
opened_reports: OpenedReportsMeasure,
|
|
|
|
resolved_reports: ResolvedReportsMeasure,
|
|
|
|
tag_accounts: TagAccountsMeasure,
|
|
|
|
tag_uses: TagUsesMeasure,
|
|
|
|
tag_servers: TagServersMeasure,
|
|
|
|
instance_accounts: InstanceAccountsMeasure,
|
|
|
|
instance_media_attachments: InstanceMediaAttachmentsMeasure,
|
|
|
|
instance_reports: InstanceReportsMeasure,
|
|
|
|
instance_statuses: InstanceStatusesMeasure,
|
|
|
|
instance_follows: InstanceFollowsMeasure,
|
|
|
|
instance_followers: InstanceFollowersMeasure,
|
2021-10-14 18:44:59 +00:00
|
|
|
}.freeze
|
|
|
|
|
2021-11-25 12:07:38 +00:00
|
|
|
def self.retrieve(measure_keys, start_at, end_at, params)
|
2023-05-23 08:49:12 +00:00
|
|
|
Array(measure_keys).filter_map do |key|
|
2021-11-25 12:07:38 +00:00
|
|
|
klass = MEASURES[key.to_sym]
|
|
|
|
klass&.new(start_at, end_at, klass.with_params? ? params.require(key.to_sym) : nil)
|
2023-05-23 08:49:12 +00:00
|
|
|
end
|
2021-10-14 18:44:59 +00:00
|
|
|
end
|
|
|
|
end
|