diff options
author | Eugen Rochko <eugen@zeonfederated.com> | 2022-02-22 15:27:08 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-22 15:27:08 +0100 |
commit | b377022cf9dfac4d98d0d10b511aeb65e540e0a3 (patch) | |
tree | 80d5c32b1e4885b053d89babed15298b151a192b /app/lib/admin/metrics/measure/tag_accounts_measure.rb | |
parent | 83388269631f377e9853858916aa8c3897f90bb4 (diff) |
Add caching layer to metrics (#17617)
Diffstat (limited to 'app/lib/admin/metrics/measure/tag_accounts_measure.rb')
-rw-r--r-- | app/lib/admin/metrics/measure/tag_accounts_measure.rb | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/app/lib/admin/metrics/measure/tag_accounts_measure.rb b/app/lib/admin/metrics/measure/tag_accounts_measure.rb index ef773081b..8f4512efe 100644 --- a/app/lib/admin/metrics/measure/tag_accounts_measure.rb +++ b/app/lib/admin/metrics/measure/tag_accounts_measure.rb @@ -9,20 +9,20 @@ class Admin::Metrics::Measure::TagAccountsMeasure < Admin::Metrics::Measure::Bas 'tag_accounts' end - def total + protected + + def perform_total_query tag.history.aggregate(time_period).accounts end - def previous_total + def perform_previous_total_query tag.history.aggregate(previous_time_period).accounts end - def data + def perform_data_query time_period.map { |date| { date: date.to_time(:utc).iso8601, value: tag.history.get(date).accounts.to_s } } end - protected - def tag @tag ||= Tag.find(params[:id]) end |