[issue #620] Changed packages actualization.
This commit is contained in:
parent
f6cc919f2f
commit
7572562cad
|
@ -203,7 +203,14 @@ class BuildList < ActiveRecord::Base
|
|||
|
||||
def actualize_packages
|
||||
ActiveRecord::Base.transaction do
|
||||
self.packages.each(&:actualize)
|
||||
old_pkgs = self.class.where(:project_id => self.project_id)
|
||||
.where(:save_to_repository_id => self.save_to_repository_id)
|
||||
.for_platform(self.build_for_platform_id)
|
||||
.scoped_to_arch(self.arch_id)
|
||||
.for_status(BUILD_PUBLISHED)
|
||||
.recent.first.packages
|
||||
old_pkgs.update_all(:actual => false)
|
||||
self.packages.update_all(:actual => true)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -22,15 +22,4 @@ class BuildList::Package < ActiveRecord::Base
|
|||
def assignee
|
||||
project.maintainer
|
||||
end
|
||||
|
||||
def actualize
|
||||
ActiveRecord::Base.transaction do
|
||||
old_pkg = self.class.by_platform(self.platform_id).actual
|
||||
.by_name(self.name).by_package_type(self.package_type)
|
||||
|
||||
old_pkg.update_all(:actual => false) if old_pkg
|
||||
self.actual = true
|
||||
self.save
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -2,9 +2,12 @@ class AddActualToBuildListPackages < ActiveRecord::Migration
|
|||
def self.up
|
||||
add_column :build_list_packages, :actual, :boolean, :default => false
|
||||
add_index :build_list_packages, [:actual, :platform_id], :name => :actual_platform_packages
|
||||
add_index :build_list, [:project_id, :save_to_repository_id, :build_for_platform_id, :arch_id]
|
||||
end
|
||||
|
||||
def self.down
|
||||
remove_column :build_list_packages, :actual
|
||||
remove_index :build_list_packages, [:actual, :platform_id], :name => :actual_platform_packages
|
||||
remove_index :build_list, [:project_id, :save_to_repository_id, :build_for_platform_id, :arch_id]
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue