#54: some refactoring MassBuild#generate_failed_builds_list

This commit is contained in:
Vokhmin Alexey V 2013-03-27 14:38:52 +04:00
parent ca3c5d4e1c
commit fa794d53c7
1 changed files with 5 additions and 4 deletions

View File

@ -55,14 +55,15 @@ class MassBuild < ActiveRecord::Base
def generate_failed_builds_list
report = ""
BuildList.where(
BuildList.select('build_lists.id, projects.name as project_name, arches.name as arch_name').
where(
:status => BuildList::BUILD_ERROR,
:mass_build_id => self.id
).includes(:project, :arch).find_in_batches(:batch_size => 100) do |build_lists|
).joins(:project, :arch).find_in_batches(:batch_size => 100) do |build_lists|
build_lists.each do |build_list|
report << "ID: #{build_list.id}; "
report << "PROJECT_NAME: #{build_list.project.name}; "
report << "ARCH: #{build_list.arch.name}\n"
report << "PROJECT_NAME: #{build_list.project_name}; "
report << "ARCH: #{build_list.arch_name}\n"
end
end
report