#778: some refactoring and fixes

This commit is contained in:
Vokhmin Alexey V 2012-12-17 19:03:52 +04:00
parent eaa26db89a
commit 514dcbe994
1 changed files with 9 additions and 6 deletions

View File

@ -193,16 +193,15 @@ class Project < ActiveRecord::Base
Platform.main.each do |main_platform| Platform.main.each do |main_platform|
add_job_to_abf_worker_queue( add_job_to_abf_worker_queue(
repository, repository,
main_platform.distrib_type, platform,
published_packages.for_platform(main_platform.id), "#{platform.path}/repository/#{main_platform.name}",
"#{platform.path}/repository/#{main_platform.name}" main_platform
) )
end end
else else
add_job_to_abf_worker_queue( add_job_to_abf_worker_queue(
repository, repository,
platform.distrib_type, platform,
published_packages,
"#{platform.path}/repository" "#{platform.path}/repository"
) )
end end
@ -211,8 +210,12 @@ class Project < ActiveRecord::Base
protected protected
def add_job_to_abf_worker_queue(repository, type, packages, platform_path) def add_job_to_abf_worker_queue(repository, platform, platform_path, main_platform = nil)
type = main_platform ? main_platform.distrib_type : platform.distrib_type
Arch.all.each do |arch| Arch.all.each do |arch|
packages = build_lists.for_status(BuildList::BUILD_PUBLISHED).
scoped_to_save_platform(platform.id)
packages = packages.for_platform(main_platform.id) if main_platform
packages = packages.scoped_to_arch(arch.id). packages = packages.scoped_to_arch(arch.id).
includes(:packages).last(10). includes(:packages).last(10).
map{ |bl| bl.packages.pluck(:fullname) }.flatten map{ |bl| bl.packages.pluck(:fullname) }.flatten