Contributed projects either have user pushes or created MRs.

This commit is contained in:
Douwe Maan 2015-02-24 16:28:40 +01:00
parent 1bf9fa8c7f
commit 5179c5830b

View file

@ -618,9 +618,10 @@ class User < ActiveRecord::Base
def contributed_projects_ids
Event.where(author_id: self).
where("created_at > ?", Time.now - 1.year).
code_push.
where("action = :pushed OR (target_type = 'MergeRequest' AND action = :created)",
pushed: Event::PUSHED, created: Event::CREATED).
reorder(project_id: :desc).
select('DISTINCT(project_id)').
map(&:project_id)
select(:project_id).
uniq
end
end