Skip to content

Commit

Permalink
[frontend] Refactor BuildControlle#result_lastsuccess
Browse files Browse the repository at this point in the history
Use Array#map instead of using a temporary variable to collect arch
results.
  • Loading branch information
bgeuken committed Feb 12, 2018
1 parent 59f0cb6 commit 892f695
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions src/api/app/controllers/build_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -165,15 +165,12 @@ def result_lastsuccess
bs = PackageBuildStatus.new(pkg).result(target_project: tprj, srcmd5: params[:srcmd5], multibuild_pkg: multibuild_package)
@result = []
bs.each do |repo, status|
archs = []
status.each do |arch, archstat|
oneline = [arch, archstat[:result]]
archs = status.map do |arch, archstat|
if archstat[:missing].blank?
oneline << nil
[arch, archstat[:result], nil]
else
oneline << archstat[:missing].join(',')
[arch, archstat[:result], archstat[:missing].join(',')]
end
archs << oneline
end
@result << [repo, archs]
end
Expand Down

0 comments on commit 892f695

Please sign in to comment.