Skip to content

Commit

Permalink
Add entire collection for the stats users count
Browse files Browse the repository at this point in the history
  • Loading branch information
sinaeftekhar committed Oct 30, 2023
1 parent ead124a commit 3f1ba09
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# frozen_string_literal: true

module Decidim
module Privacy
module StatsUsersCountExtensions
extend ActiveSupport::Concern
included do
def query
users = Decidim::User.entire_collection.where(organization: @organization).not_deleted.not_blocked.confirmed
users = users.where("created_at >= ?", @start_at) if @start_at.present?
users = users.where("created_at <= ?", @end_at) if @end_at.present?
users.count
end
end
end
end
end
14 changes: 14 additions & 0 deletions lib/decidim/privacy/engine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,20 @@ class Engine < ::Rails::Engine
Decidim::Privacy::UserPresenterExtensions
)

# Queries
Decidim::UserGroups::AcceptedMemberships.include(
Decidim::Privacy::AcceptedMembershipsExtensions
)
Decidim::UserGroups::MemberMemberships.include(
Decidim::Privacy::MemberMembershipsExtensions
)
Decidim::UserGroups::AdminMemberships.include(
Decidim::Privacy::AdminMembershipsExtensions
)
Decidim::StatsUsersCount.include(
Decidim::Privacy::StatsUsersCountExtensions
)

# Initialize concerns for each installed Decidim-module
if Decidim.module_installed? :budgets
# models
Expand Down

0 comments on commit 3f1ba09

Please sign in to comment.