diff --git a/app/controllers/protocols_controller.rb b/app/controllers/protocols_controller.rb
index 05c55fad1..70c22b2b9 100644
--- a/app/controllers/protocols_controller.rb
+++ b/app/controllers/protocols_controller.rb
@@ -700,16 +700,17 @@ class ProtocolsController < ApplicationController
step['components'].each do |key,value|
element_string = nil
- if counter <= 1
- # here i made an if to distinguish the first step from the others,
- # because the first step
- # sometimes has index values as keys instead of hashes, for no good reason
- key = value if value.class == Hash
- end
+
+
+ # sometimes there are random index values as keys
+ # instead of hashes, this is a workaround to that buggy json format
+ key = value if value.class == Hash
+
if whitelist_simple.include?(key['component_type_id'])
case key['component_type_id']
when '1'
+
if !key['data'].nil? && key['data'] != ''
element_string = '
' + (key['data']) + '
'
if @import_object['steps'][step_pos.to_s]['description']
@@ -718,7 +719,8 @@ class ProtocolsController < ApplicationController
@import_object['steps'][step_pos.to_s]['description'] = element_string
end
else
- @import_object['steps'][step_pos.to_s]['description'] ||= 'Description missing!'
+
+ @import_object['steps'][step_pos.to_s]['description'] = 'Description missing!'
end
when '6'
if !key['data'].nil? && key['data'] != ''
diff --git a/app/views/protocols/import_export/_import_json_protocol_preview_modal.html.erb b/app/views/protocols/import_export/_import_json_protocol_preview_modal.html.erb
index 8a479cc19..c717d2b6e 100644
--- a/app/views/protocols/import_export/_import_json_protocol_preview_modal.html.erb
+++ b/app/views/protocols/import_export/_import_json_protocol_preview_modal.html.erb
@@ -121,11 +121,11 @@ CGI.parse(URI.parse(request.referrer).query).fetch("type") %>
<% title=nil %>
<% step["components"].each do |key1,value1| #finding section (title of step) %>
- <% if counter <=1 %>
+
<% if value1.class==Hash %>
<% key1=value1 %>
<% end %>
- <% end %>
+
<% if(key1["component_type_id"]=="6") %>
<% if(!key1["data"].nil? && key1["data"]!="") %>
<% title ||=key1["data"] %>
@@ -146,14 +146,14 @@ CGI.parse(URI.parse(request.referrer).query).fetch("type") %>