Merge pull request #1029 from Zanz2/empty_step_hash_fix

protocols io hash key instead of index bug in null step checker [SCI-2166]
This commit is contained in:
Zanz2 2018-03-14 21:01:15 +01:00 committed by GitHub
commit ce860a740e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -165,7 +165,11 @@ module ProtocolsIoHelper
end
def step_hash_null?(step_json)
step_json.dig(0, 'components', 0, 'component_type_id').nil?
step_json.dig(
0, 'components', 0, 'component_type_id'
).nil? && step_json.dig(
0, 'components', '0', 'component_type_id'
).nil?
end
# Images are allowed in:
@ -350,7 +354,6 @@ module ProtocolsIoHelper
return unordered_step_json if base_step.nil?
number_of_steps = unordered_step_json.size
return unordered_step_json if number_of_steps == 1
base_step = unordered_step_json.find { |step| step['previous_guid'].nil? }
step_order = []
step_counter = 0
step_order[step_counter] = base_step