From 9b7360eebfc067ff5f4832c628f41d4b6d42a158 Mon Sep 17 00:00:00 2001 From: Oleksii Kriuchykhin Date: Tue, 20 Sep 2016 13:41:29 +0200 Subject: [PATCH 1/2] Fixes issue with import of empty protocol [fixes SCI-314] --- app/utilities/protocols_importer.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/utilities/protocols_importer.rb b/app/utilities/protocols_importer.rb index aec869371..7ba862cc6 100644 --- a/app/utilities/protocols_importer.rb +++ b/app/utilities/protocols_importer.rb @@ -48,7 +48,9 @@ module ProtocolsImporter asset_ids = [] step_pos = 0 - protocol_json["steps"].values.each do |step_json| + # Check if protocol has steps + if protocol_json["steps"] + protocol_json["steps"].values.each do |step_json| step = Step.create!( name: step_json["name"], description: step_json["description"], @@ -120,6 +122,7 @@ module ProtocolsImporter end end end + end # Post process assets asset_ids.each do |asset_id| From 28ab5993731e69849cd7aa6e3a4d13d79444f36f Mon Sep 17 00:00:00 2001 From: Oleksii Kriuchykhin Date: Thu, 22 Sep 2016 16:36:37 +0200 Subject: [PATCH 2/2] Change double quotes to single [fixes SCI-314] --- app/utilities/protocols_importer.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/utilities/protocols_importer.rb b/app/utilities/protocols_importer.rb index 7ba862cc6..0c3e64359 100644 --- a/app/utilities/protocols_importer.rb +++ b/app/utilities/protocols_importer.rb @@ -49,8 +49,8 @@ module ProtocolsImporter asset_ids = [] step_pos = 0 # Check if protocol has steps - if protocol_json["steps"] - protocol_json["steps"].values.each do |step_json| + if protocol_json['steps'] + protocol_json['steps'].values.each do |step_json| step = Step.create!( name: step_json["name"], description: step_json["description"],