mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-03-04 19:53:19 +08:00
Fix importing items when input format is incorrect [SCI-10874]
This commit is contained in:
parent
8c6b36a4c1
commit
181b55b1a1
2 changed files with 9 additions and 10 deletions
|
@ -64,15 +64,6 @@ module RepositoryImportParser
|
|||
end
|
||||
end
|
||||
|
||||
def handle_invalid_cell_value(value, cell_value)
|
||||
if value.present? && cell_value.nil?
|
||||
@errors << 'Incorrect data format'
|
||||
true
|
||||
else
|
||||
false
|
||||
end
|
||||
end
|
||||
|
||||
def import_rows!
|
||||
checked_rows = []
|
||||
duplicate_ids = SpreadsheetParser.duplicate_ids(@sheet)
|
||||
|
@ -179,7 +170,13 @@ module RepositoryImportParser
|
|||
@user.as_json(root: true, only: :settings).deep_symbolize_keys
|
||||
)
|
||||
end
|
||||
next if handle_invalid_cell_value(value, cell_value)
|
||||
|
||||
if value.present? && cell_value.nil?
|
||||
raise ActiveRecord::Rollback unless @preview
|
||||
|
||||
@errors << I18n.t('activerecord.errors.models.repository_cell.incorrect_format')
|
||||
next
|
||||
end
|
||||
|
||||
existing_cell = repository_row.repository_cells.find { |c| c.repository_column_id == column.id }
|
||||
|
||||
|
|
|
@ -234,6 +234,8 @@ en:
|
|||
repository_row_connection:
|
||||
self_connection: 'A repository_row cannot have a connection with itself'
|
||||
reciprocal_connection: 'Reciprocal connections are not allowed'
|
||||
repository_cell:
|
||||
incorrect_format: 'Incorrect data format'
|
||||
webhook:
|
||||
attributes:
|
||||
configuration:
|
||||
|
|
Loading…
Reference in a new issue