Skip to content

Commit

Permalink
[api] save the attribute too in clean up job
Browse files Browse the repository at this point in the history
  • Loading branch information
coolo committed Jan 28, 2014
1 parent 5b4841b commit 1be4577
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/api/app/jobs/project_create_auto_cleanup_requests.rb
Expand Up @@ -18,10 +18,10 @@ def perform

# defaults
User.current ||= User.find_by_login "Admin"
at = AttribType.find_by_namespace_and_name("OBS", "AutoCleanup")
@cleanup_attribute = AttribType.find_by_namespace_and_name("OBS", "AutoCleanup")
@cleanupTime = DateTime.now + cleanupDays.days

Project.find_by_attribute_type(at).each do |prj|
Project.find_by_attribute_type(@cleanup_attribute).each do |prj|
autoclean_project(prj)
end
end
Expand All @@ -36,7 +36,7 @@ def autoclean_project(prj)
# check the time in project attribute
time = nil
begin
return unless attribute = prj.attribs.find_by_attrib_type_id(at.id)
return unless attribute = prj.attribs.find_by_attrib_type_id(@cleanup_attribute.id)
return unless time = DateTime.parse(attribute.values.first.value)
rescue ArgumentError
# not parseable time
Expand Down

0 comments on commit 1be4577

Please sign in to comment.