mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-12-25 01:03:18 +08:00
Improve handling of responses from protocols parser [SCI-8817]
This commit is contained in:
parent
acb1a034a8
commit
2ab559be97
1 changed files with 4 additions and 4 deletions
|
@ -88,8 +88,8 @@ module Protocols
|
||||||
|
|
||||||
def create_step_table_element!(step, step_element_json)
|
def create_step_table_element!(step, step_element_json)
|
||||||
table = Table.create!(
|
table = Table.create!(
|
||||||
name: step_element_json['name'],
|
name: step_element_json['name'].presence || 'New table',
|
||||||
contents: step_element_json['table']['contents'],
|
contents: step_element_json['contents'],
|
||||||
created_by: @user,
|
created_by: @user,
|
||||||
last_modified_by: @user,
|
last_modified_by: @user,
|
||||||
team: @team
|
team: @team
|
||||||
|
@ -100,13 +100,13 @@ module Protocols
|
||||||
|
|
||||||
def create_step_list_element!(step, step_element_json)
|
def create_step_list_element!(step, step_element_json)
|
||||||
checklist = Checklist.create!(
|
checklist = Checklist.create!(
|
||||||
name: step_element_json['list']['name'].presence || 'New list',
|
name: step_element_json['name'].presence || 'New list',
|
||||||
step: step,
|
step: step,
|
||||||
created_by: @user,
|
created_by: @user,
|
||||||
last_modified_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!(
|
checklist.checklist_items.create!(
|
||||||
text: item.truncate(Constants::TEXT_MAX_LENGTH),
|
text: item.truncate(Constants::TEXT_MAX_LENGTH),
|
||||||
checked: false,
|
checked: false,
|
||||||
|
|
Loading…
Reference in a new issue