Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Lopez <james@jameslopez.es>2017-07-07 10:29:00 +0300
committerJames Lopez <james@jameslopez.es>2017-07-07 11:38:57 +0300
commit1a7d2aba3b06a1e4fcc3861eeb70af30fc3330f6 (patch)
tree749815838ad52bc4547f4d6d28f56a8e623fe319 /app/finders/users_finder.rb
parentb08df253ef16d635883451aafeb71b4a6f4ccd09 (diff)
add created at filter logic to users finder and API
Diffstat (limited to 'app/finders/users_finder.rb')
-rw-r--r--app/finders/users_finder.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/app/finders/users_finder.rb b/app/finders/users_finder.rb
index 07deceb827b..ae031162892 100644
--- a/app/finders/users_finder.rb
+++ b/app/finders/users_finder.rb
@@ -29,6 +29,7 @@ class UsersFinder
users = by_active(users)
users = by_external_identity(users)
users = by_external(users)
+ users = by_created_at(users)
users
end
@@ -71,4 +72,16 @@ class UsersFinder
users.external
end
+
+ def by_created_at(users)
+ if params[:created_after].present?
+ users = users.where(users.klass.arel_table[:created_at].gteq(params[:created_after]))
+ end
+
+ if params[:created_before].present?
+ users = users.where(users.klass.arel_table[:created_at].lteq(params[:created_before]))
+ end
+
+ users
+ end
end