mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-12-27 10:14:17 +08:00
Merge pull request #2894 from okriuchykhin/ok_SCI_5094
Improve handling of empty cells in inventory imports [SCI-5094]
This commit is contained in:
commit
43e94ea84c
2 changed files with 4 additions and 0 deletions
|
@ -75,6 +75,8 @@ class RepositoryChecklistValue < ApplicationRecord
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.import_from_text(text, attributes, _options = {})
|
def self.import_from_text(text, attributes, _options = {})
|
||||||
|
return nil if text.blank?
|
||||||
|
|
||||||
value = new(attributes)
|
value = new(attributes)
|
||||||
column = attributes.dig(:repository_cell_attributes, :repository_column)
|
column = attributes.dig(:repository_cell_attributes, :repository_column)
|
||||||
RepositoryImportParser::Util.split_by_delimiter(text: text, delimiter: column.delimiter_char).each do |item_text|
|
RepositoryImportParser::Util.split_by_delimiter(text: text, delimiter: column.delimiter_char).each do |item_text|
|
||||||
|
|
|
@ -66,6 +66,8 @@ class RepositoryListValue < ApplicationRecord
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.import_from_text(text, attributes, _options = {})
|
def self.import_from_text(text, attributes, _options = {})
|
||||||
|
return nil if text.blank?
|
||||||
|
|
||||||
value = new(attributes)
|
value = new(attributes)
|
||||||
column = attributes.dig(:repository_cell_attributes, :repository_column)
|
column = attributes.dig(:repository_cell_attributes, :repository_column)
|
||||||
list_item = column.repository_list_items.find { |item| item.data == text }
|
list_item = column.repository_list_items.find { |item| item.data == text }
|
||||||
|
|
Loading…
Reference in a new issue