Skip to content

Commit

Permalink
change max lines to csv referentiel
Browse files Browse the repository at this point in the history
  • Loading branch information
lisa-durand committed Feb 18, 2025
1 parent 8fb59d7 commit 8269be0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app/controllers/administrateurs/types_de_champ_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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

Expand Down

0 comments on commit 8269be0

Please sign in to comment.