summaryrefslogtreecommitdiff
path: root/app/finders
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2015-10-08 16:22:43 +0200
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2015-10-08 16:22:43 +0200
commit69bcef32e12cca8a4a31c3035509d479a712b504 (patch)
tree7ff4b1e444ba1ba470f5f2da29f168b3e487c672 /app/finders
parenta2374758e34475ebdfacbe68b6c5b095b66262ec (diff)
parent4841e883020146fecd386caff7f31f2d9cf307b6 (diff)
downloadgitlab-ce-69bcef32e12cca8a4a31c3035509d479a712b504.tar.gz
Merge remote-tracking branch 'public/trending-projects-performance'
Diffstat (limited to 'app/finders')
-rw-r--r--app/finders/trending_projects_finder.rb11
1 files changed, 2 insertions, 9 deletions
diff --git a/app/finders/trending_projects_finder.rb b/app/finders/trending_projects_finder.rb
index 9ea342cb26d..81a12403801 100644
--- a/app/finders/trending_projects_finder.rb
+++ b/app/finders/trending_projects_finder.rb
@@ -1,13 +1,6 @@
class TrendingProjectsFinder
- def execute(current_user, start_date = nil)
- start_date ||= Date.today - 1.month
-
- projects = projects_for(current_user)
-
- # Determine trending projects based on comments count
- # for period of time - ex. month
- projects.joins(:notes).where('notes.created_at > ?', start_date).
- group("projects.id").reorder("count(notes.id) DESC")
+ def execute(current_user, start_date = 1.month.ago)
+ projects_for(current_user).trending(start_date)
end
private