-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add entire collection for the stats users count
- Loading branch information
1 parent
ead124a
commit 3f1ba09
Showing
2 changed files
with
31 additions
and
0 deletions.
There are no files selected for viewing
17 changes: 17 additions & 0 deletions
17
app/queries/concerns/decidim/privacy/stats_users_count_extensions.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters