[refs #604] Remove old build list after 3 month

This commit is contained in:
Vladimir Sharshov 2012-08-06 19:35:11 +04:00
parent dd1bf7719f
commit 08c58a84df
1 changed files with 3 additions and 2 deletions

View File

@ -23,7 +23,8 @@ class BuildList < ActiveRecord::Base
errors.add(:build_for_platform, I18n.t('flash.build_list.wrong_platform')) if save_to_platform.platform_type == 'main' && save_to_platform_id != build_for_platform_id
}
LIVE_TIME = 3.week
LIVE_TIME = 4.week # for unpublished
MAX_LIVE_TIME = 3.month # for published
# The kernel does not send these statuses directly
BUILD_CANCELED = 5000
@ -92,7 +93,7 @@ class BuildList < ActiveRecord::Base
s
}
scope :scoped_to_project_name, lambda {|project_name| joins(:project).where('projects.name LIKE ?', "%#{project_name}%")}
scope :outdated, where('updated_at < ? AND status <> ?', Time.now - LIVE_TIME, BUILD_PUBLISHED)
scope :outdated, where('created_at < ? AND status <> ? OR created_at < ?', Time.now - LIVE_TIME, BUILD_PUBLISHED, Time.now - MAX_LIVE_TIME)
serialize :additional_repos
serialize :include_repos