Few more filters for admin / projects

This commit is contained in:
Dmitriy Zaporozhets 2013-01-14 09:37:29 +02:00
parent 68bfcd0521
commit 8543313bf5
3 changed files with 25 additions and 1 deletions

View file

@ -84,6 +84,14 @@ class Project < ActiveRecord::Base
scope :public, where(public: true)
class << self
def abandoned
project_ids = Event.select('max(created_at) as latest_date, project_id').
group('project_id').
having('latest_date < ?', 6.months.ago).map(&:project_id)
where(id: project_ids)
end
def active
joins(:issues, :notes, :merge_requests).order("issues.created_at, notes.created_at, merge_requests.created_at DESC")
end