mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-02-22 14:54:38 +08:00
Fixed last few rubocop errors
This commit is contained in:
parent
6cf775a4b1
commit
67b09adaeb
1 changed files with 12 additions and 6 deletions
|
@ -901,10 +901,13 @@ class ProtocolsController < ApplicationController
|
||||||
|
|
||||||
# pio_stp_x means protocols io step (id of component) parser
|
# pio_stp_x means protocols io step (id of component) parser
|
||||||
def pio_stp_1(iterating_key) # protocols io description parser
|
def pio_stp_1(iterating_key) # protocols io description parser
|
||||||
append = '<br>' + sanitize_input(iterating_key) + '<br>' if iterating_key.present?
|
br = '<br>'
|
||||||
append = t('protocols.protocols_io_import.comp_append.missing_desc') if iterating_key.blank?
|
append = br + sanitize_input(iterating_key) + br if iterating_key.present?
|
||||||
return append if append.present?
|
if iterating_key.blank?
|
||||||
''
|
append = t('protocols.protocols_io_import.comp_append.missing_desc')
|
||||||
|
return append
|
||||||
|
end
|
||||||
|
append
|
||||||
end
|
end
|
||||||
|
|
||||||
def pio_stp_6(iterating_key) # protocols io section(title) parser
|
def pio_stp_6(iterating_key) # protocols io section(title) parser
|
||||||
|
@ -1056,12 +1059,15 @@ class ProtocolsController < ApplicationController
|
||||||
# id 19= safety information ,
|
# id 19= safety information ,
|
||||||
# id 20= regents (materials, like scinote samples kind of)
|
# id 20= regents (materials, like scinote samples kind of)
|
||||||
newj['steps'] = {}
|
newj['steps'] = {}
|
||||||
|
# I use these 2 variables below to avoid rubocop errors
|
||||||
|
desc = 'description'
|
||||||
|
name = 'name'
|
||||||
original_json['steps'].each_with_index do |step, i| # loop over steps
|
original_json['steps'].each_with_index do |step, i| # loop over steps
|
||||||
# position of step (first, second.... etc),
|
# position of step (first, second.... etc),
|
||||||
newj['steps'][i.to_s] = {} # the json we will insert into db
|
newj['steps'][i.to_s] = {} # the json we will insert into db
|
||||||
newj['steps'][i.to_s]['position'] = i
|
newj['steps'][i.to_s]['position'] = i
|
||||||
newj['steps'][i.to_s]['description'] = '' unless newj['steps'][i.to_s].key?('description')
|
newj['steps'][i.to_s][desc] = '' unless newj['steps'][i.to_s].key?(desc)
|
||||||
newj['steps'][i.to_s]['name'] = '' unless newj['steps'][i.to_s].key?('name')
|
newj['steps'][i.to_s][name] = '' unless newj['steps'][i.to_s].key?(name)
|
||||||
step['components'].each do |key, value|
|
step['components'].each do |key, value|
|
||||||
# sometimes there are random index values as keys
|
# sometimes there are random index values as keys
|
||||||
# instead of hashes, this is a workaround to that buggy json format
|
# instead of hashes, this is a workaround to that buggy json format
|
||||||
|
|
Loading…
Reference in a new issue