mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-09-20 14:45:56 +08:00
Fix importing items when input format is incorrect [SCI-10874]
This commit is contained in:
parent
8c6b36a4c1
commit
181b55b1a1
|
@ -64,15 +64,6 @@ module RepositoryImportParser
|
||||||
end
|
end
|
||||||
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!
|
def import_rows!
|
||||||
checked_rows = []
|
checked_rows = []
|
||||||
duplicate_ids = SpreadsheetParser.duplicate_ids(@sheet)
|
duplicate_ids = SpreadsheetParser.duplicate_ids(@sheet)
|
||||||
|
@ -179,7 +170,13 @@ module RepositoryImportParser
|
||||||
@user.as_json(root: true, only: :settings).deep_symbolize_keys
|
@user.as_json(root: true, only: :settings).deep_symbolize_keys
|
||||||
)
|
)
|
||||||
end
|
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 }
|
existing_cell = repository_row.repository_cells.find { |c| c.repository_column_id == column.id }
|
||||||
|
|
||||||
|
|
|
@ -234,6 +234,8 @@ en:
|
||||||
repository_row_connection:
|
repository_row_connection:
|
||||||
self_connection: 'A repository_row cannot have a connection with itself'
|
self_connection: 'A repository_row cannot have a connection with itself'
|
||||||
reciprocal_connection: 'Reciprocal connections are not allowed'
|
reciprocal_connection: 'Reciprocal connections are not allowed'
|
||||||
|
repository_cell:
|
||||||
|
incorrect_format: 'Incorrect data format'
|
||||||
webhook:
|
webhook:
|
||||||
attributes:
|
attributes:
|
||||||
configuration:
|
configuration:
|
||||||
|
|
Loading…
Reference in a new issue