[issue #428] Attempt to fix packages listing

This commit is contained in:
George Vinogradov 2012-07-04 20:52:22 +04:00
parent 02ae717af9
commit 8c9cca39ef
2 changed files with 14 additions and 5 deletions

View File

@ -19,9 +19,18 @@ class AdvisoriesController < ApplicationController
@packages_info = Hash.new { |h, k| h[k] = {} }
@advisory.build_lists.find_in_batches(:include => [:save_to_platform, :packages, :project]) do |batch|
batch.each do |build_list|
h = { build_list.project => build_list.packages }
# FIXME Maybe memory leak...
@packages_info[build_list.save_to_platform].merge!(h) { |pr, old, new| (old + new).compact.uniq }
tmp = build_list.packages.inject({:srpm => nil, :rpm => []}) do |h, p|
p.package_type == 'binary' ? h[:rpm] << p : h[:srpm] = p
h
end
h = { build_list.project => tmp }
@packages_info[build_list.save_to_platform].merge!(h) do |pr, old, new|
{:srpm => new[:srpm], :rpm => old[:rpm].concat(new[:rpm]).uniq}
end
# h = { build_list.project => build_list.packages }
# # FIXME Maybe memory leak...
# @packages_info[build_list.save_to_platform].merge!(h) { |pr, old, new| (old + new).compact.uniq }
end
end
end

View File

@ -12,9 +12,9 @@
%li
%p= "SRPM:"
%ul
%li= project.srpm_file_name
%li= packages[:srpm].fullname
%li
%p= "RPM:"
%ul
- packages.each do |package|
- packages[:rpm].each do |package|
%li= package.fullname