Change domain block CSV parsing to be more robust and handle more lists (#21470)
* Change domain block CSV parsing to be more robust and handle more lists * Add some tests * Improve domain block import validation and reporting
This commit is contained in:
parent
302fcb9788
commit
fcc4c9b34a
8 changed files with 90 additions and 39 deletions
|
@ -26,14 +26,4 @@ module AdminExportControllerConcern
|
|||
def import_params
|
||||
params.require(:admin_import).permit(:data)
|
||||
end
|
||||
|
||||
def import_data_path
|
||||
params[:admin_import][:data].path
|
||||
end
|
||||
|
||||
def parse_import_data!(default_headers)
|
||||
data = CSV.read(import_data_path, headers: true, encoding: 'UTF-8')
|
||||
data = CSV.read(import_data_path, headers: default_headers, encoding: 'UTF-8') unless data.headers&.first&.strip&.include?(default_headers[0])
|
||||
@data = data.reject(&:blank?)
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue