From 8269be082bb03a3ae78ac0dc2fa4b9a0d30d584e Mon Sep 17 00:00:00 2001 From: Lisa Durand Date: Mon, 17 Feb 2025 16:46:36 +0100 Subject: [PATCH] change max lines to csv referentiel --- app/controllers/administrateurs/types_de_champ_controller.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/administrateurs/types_de_champ_controller.rb b/app/controllers/administrateurs/types_de_champ_controller.rb index c5751112e8e..5ec4147fb1c 100644 --- a/app/controllers/administrateurs/types_de_champ_controller.rb +++ b/app/controllers/administrateurs/types_de_champ_controller.rb @@ -9,7 +9,7 @@ class TypesDeChampController < AdministrateurController before_action :reload_procedure_with_includes, only: [:destroy] CSV_MAX_SIZE = 1.megabyte - CSV_MAX_LINES = 1000 + CSV_MAX_LINES = 10_000 CSV_ACCEPTED_CONTENT_TYPES = [ "text/csv", "application/vnd.ms-excel" @@ -155,7 +155,7 @@ def import_referentiel csv_to_code = ACSV::CSV.new_for_ruby3(file.encode("UTF-8", base_encoding[:encoding], invalid: :replace, replace: ""), headers: true).map(&:to_h) - return flash[:alert] = "Importation impossible : votre fichier CSV fait plus de 1000 lignes" if csv_to_code.size > 1000 + return flash[:alert] = "Importation impossible : votre fichier CSV fait plus de #{CSV_MAX_LINES} lignes" if csv_to_code.size > CSV_MAX_LINES headers = csv_to_code.first.keys