Merge pull request #2894 from okriuchykhin/ok_SCI_5094

Improve handling of empty cells in inventory imports [SCI-5094]
This commit is contained in:
Alex Kriuchykhin 2020-10-12 16:53:09 +02:00 committed by GitHub
commit 43e94ea84c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 0 deletions

View file

@ -75,6 +75,8 @@ class RepositoryChecklistValue < ApplicationRecord
end
def self.import_from_text(text, attributes, _options = {})
return nil if text.blank?
value = new(attributes)
column = attributes.dig(:repository_cell_attributes, :repository_column)
RepositoryImportParser::Util.split_by_delimiter(text: text, delimiter: column.delimiter_char).each do |item_text|

View file

@ -66,6 +66,8 @@ class RepositoryListValue < ApplicationRecord
end
def self.import_from_text(text, attributes, _options = {})
return nil if text.blank?
value = new(attributes)
column = attributes.dig(:repository_cell_attributes, :repository_column)
list_item = column.repository_list_items.find { |item| item.data == text }