#298: small refactoring

This commit is contained in:
Vokhmin Alexey V 2013-09-09 23:04:56 +04:00
parent e7e5414db7
commit 04fe55b202
1 changed files with 7 additions and 3 deletions

View File

@ -284,9 +284,13 @@ class BuildList < ActiveRecord::Base
return false if !(auto_publish? && can_publish?)
if last_bl = last_published.last
return true if last_bl.source_packages.count != source_packages.count
last_bl.source_packages.each do |sp|
return true if source_packages.find{ |nsp| nsp.name == sp.name && nsp.version > sp.version }
source_packages.each do |nsp|
sp = last_bl.source_packages.find{ |sp| nsp.name == sp.name }
return true unless sp
sp_version = sp.version.split(/\D/).map(&:to_i)
nsp.version.split(/\D/).map(&:to_i).each_with_index do |nv, index|
return true if nv > sp_version[index].to_i
end
end
else
return true # no published packages