Commit e06e5633 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Refactor Project.abandoned method

parent 4daf68b5
...@@ -110,11 +110,7 @@ class Project < ActiveRecord::Base ...@@ -110,11 +110,7 @@ class Project < ActiveRecord::Base
class << self class << self
def abandoned def abandoned
project_ids = Event.select('max(created_at) as latest_date, project_id'). where('projects.last_activity_at < ?', 6.months.ago)
group('project_id').
having('latest_date < ?', 6.months.ago).map(&:project_id)
where(id: project_ids)
end end
def with_push def with_push
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment