In the pipeline instance comparison, do not blow up when a row component
authorWard Vandewege <ward@curoverse.com>
Wed, 12 Feb 2014 20:52:13 +0000 (15:52 -0500)
committerWard Vandewege <ward@curoverse.com>
Wed, 12 Feb 2014 20:52:13 +0000 (15:52 -0500)
is not defined (for example, when one or more of the pipeline instances
in the comparison has not yet been executed).

apps/workbench/app/controllers/pipeline_instances_controller.rb

index 7ca4f6a11ed2d6c6f4c5fdead9362d1eee74df0f..42cb2e9d44c8af1155f56133c7463476013049f5 100644 (file)
@@ -95,6 +95,7 @@ class PipelineInstancesController < ApplicationController
       highscore = {}           # attr => how common "normal" is
       score = {}               # attr => { value => how common }
       row[:components].each do |pj|
+        next if pj.nil?
         pj.each do |k,v|
           vstr = for_comparison v
           score[k] ||= {}
@@ -113,6 +114,7 @@ class PipelineInstancesController < ApplicationController
 
       # Add a hash in component[:is_normal]: { attr => is_the_value_normal? }
       row[:components].each do |pj|
+        next if pj.nil?
         pj[:is_normal] = {}
         pj.each do |k,v|
           pj[:is_normal][k] = (normal.has_key?(k) && normal[k] == for_comparison(v))