Sha256: 2b4130d6ec30f43385531c4f19b5eac1eb78b50caca82589ff5f37ece689b6da

Contents?: true

Size: 643 Bytes

Versions: 50

Compression:

Stored size: 643 Bytes

Contents

# frozen_string_literal: true

module Decidim
  module Metrics
    # Metric manager for User's registries
    class UserReportsMetricManage < Decidim::MetricManage
      def metric_name
        "user_reports"
      end

      private

      def query
        return @query if @query

        @query = Decidim::User.where(organization: @organization).joins(:user_reports)
        @query = @query.where("#{Decidim::UserReport.table_name}.created_at <= ?", end_time)
        @query
      end

      def quantity
        @quantity ||= @query.where("#{Decidim::UserReport.table_name}.created_at >= ?", start_time).count
      end
    end
  end
end

Version data entries

50 entries across 50 versions & 1 rubygems

Version Path
decidim-core-0.25.0.rc4 app/queries/decidim/metrics/user_reports_metric_manage.rb
decidim-core-0.25.0.rc3 app/queries/decidim/metrics/user_reports_metric_manage.rb
decidim-core-0.25.0.rc2 app/queries/decidim/metrics/user_reports_metric_manage.rb
decidim-core-0.25.0.rc1 app/queries/decidim/metrics/user_reports_metric_manage.rb
decidim-core-0.24.3 app/queries/decidim/metrics/user_reports_metric_manage.rb
decidim-core-0.24.2 app/queries/decidim/metrics/user_reports_metric_manage.rb
decidim-core-0.24.1 app/queries/decidim/metrics/user_reports_metric_manage.rb
decidim-core-0.24.0 app/queries/decidim/metrics/user_reports_metric_manage.rb
decidim-core-0.24.0.rc2 app/queries/decidim/metrics/user_reports_metric_manage.rb
decidim-core-0.24.0.rc1 app/queries/decidim/metrics/user_reports_metric_manage.rb