diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2015-03-23 16:40:55 +0000 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2015-03-23 16:40:55 +0000 |
commit | e24da35984c13132e204ff923e4b75600ebed56e (patch) | |
tree | 73c373598b5b5a97df452adcaa6496b3aed223a0 /app/models/user.rb | |
parent | 3ca34bb8f0fa4fa3a40e9ccc44cd5d8784f30c7d (diff) | |
parent | b449bc5b77aa658db67ebcb25f709fe51c29b129 (diff) | |
download | gitlab-ce-e24da35984c13132e204ff923e4b75600ebed56e.tar.gz |
Merge branch 'improve-contributions-calendar' into 'master'
Replace commits calendar with contributions calendar
* count opening of issues and merge requests
* dont trigger git repository - use events from database
* count pushes instead of commits for faster and easier counting
* much-much faster since does not affected by repository size
See merge request !420
Diffstat (limited to 'app/models/user.rb')
-rw-r--r-- | app/models/user.rb | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/app/models/user.rb b/app/models/user.rb index ba325132df8..50f664a09a3 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -603,13 +603,10 @@ class User < ActiveRecord::Base end def contributed_projects_ids - Event.where(author_id: self). + Event.contributions.where(author_id: self). where("created_at > ?", Time.now - 1.year). - where("action = :pushed OR (target_type = 'MergeRequest' AND action = :created)", - pushed: Event::PUSHED, created: Event::CREATED). reorder(project_id: :desc). select(:project_id). - uniq - .map(&:project_id) + uniq.map(&:project_id) end end |