From 2ab559be971e638a7dcf9e20da031e99166d69a3 Mon Sep 17 00:00:00 2001 From: Oleksii Kriuchykhin Date: Wed, 16 Aug 2023 13:26:41 +0200 Subject: [PATCH] Improve handling of responses from protocols parser [SCI-8817] --- app/jobs/protocols/docx_import_job.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/jobs/protocols/docx_import_job.rb b/app/jobs/protocols/docx_import_job.rb index b68da5fa3..d5f61884f 100644 --- a/app/jobs/protocols/docx_import_job.rb +++ b/app/jobs/protocols/docx_import_job.rb @@ -88,8 +88,8 @@ module Protocols def create_step_table_element!(step, step_element_json) table = Table.create!( - name: step_element_json['name'], - contents: step_element_json['table']['contents'], + name: step_element_json['name'].presence || 'New table', + contents: step_element_json['contents'], created_by: @user, last_modified_by: @user, team: @team @@ -100,13 +100,13 @@ module Protocols def create_step_list_element!(step, step_element_json) checklist = Checklist.create!( - name: step_element_json['list']['name'].presence || 'New list', + name: step_element_json['name'].presence || 'New list', step: step, created_by: @user, last_modified_by: @user ) - step_element_json['list']['contents'].each do |item| + step_element_json['contents'].each do |item| checklist.checklist_items.create!( text: item.truncate(Constants::TEXT_MAX_LENGTH), checked: false,