diff --git a/app/utilities/repository_import_parser/importer.rb b/app/utilities/repository_import_parser/importer.rb index 7fd39e506..3393124b7 100644 --- a/app/utilities/repository_import_parser/importer.rb +++ b/app/utilities/repository_import_parser/importer.rb @@ -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 } diff --git a/config/locales/en.yml b/config/locales/en.yml index e48b383cc..b7b149c39 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -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: