Commit e06e5633b38ba988135e5ee1ead33a9bbfadd361
1 parent
4daf68b5
Exists in
master
and in
4 other branches
Refactor Project.abandoned method
Showing
1 changed file
with
1 additions
and
5 deletions
Show diff stats
app/models/project.rb
| ... | ... | @@ -110,11 +110,7 @@ class Project < ActiveRecord::Base |
| 110 | 110 | |
| 111 | 111 | class << self |
| 112 | 112 | def abandoned |
| 113 | - project_ids = Event.select('max(created_at) as latest_date, project_id'). | |
| 114 | - group('project_id'). | |
| 115 | - having('latest_date < ?', 6.months.ago).map(&:project_id) | |
| 116 | - | |
| 117 | - where(id: project_ids) | |
| 113 | + where('projects.last_activity_at < ?', 6.months.ago) | |
| 118 | 114 | end |
| 119 | 115 | |
| 120 | 116 | def with_push | ... | ... |