diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 000000000..6d3c8e191 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,14 @@ +# Dependabot's documentation for all configuration options: +# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates + +version: 2 +updates: + - package-ecosystem: "bundler" + directory: "/" # Location of package manifests + schedule: + interval: "daily" + +# - package-ecosystem: "npm" # See documentation for possible values +# directory: "/" # Location of package manifests +# schedule: +# interval: "daily" diff --git a/Gemfile.lock b/Gemfile.lock index dd871a642..115805861 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -274,7 +274,7 @@ GEM multi_json request_store (>= 1.0) graphql (1.10.9) - graphql-batch (0.4.2) + graphql-batch (0.4.3) graphql (>= 1.3, < 2) promise.rb (~> 0.7.2) graphql-rails_logger (1.2.2) diff --git a/app/controllers/new_administrateur/procedure_administrateurs_controller.rb b/app/controllers/new_administrateur/procedure_administrateurs_controller.rb index a35b980a6..08e949e2d 100644 --- a/app/controllers/new_administrateur/procedure_administrateurs_controller.rb +++ b/app/controllers/new_administrateur/procedure_administrateurs_controller.rb @@ -11,7 +11,7 @@ module NewAdministrateur # Find the admin administrateur = Administrateur.by_email(email) if administrateur.nil? - flash.alert = "L’administrateur « #{email} » n’existe pas. Invitez-le à demander un compte administrateur à l’addresse #{new_demande_url}." + flash.alert = "L’administrateur « #{email} » n’existe pas. Invitez-le à demander un compte administrateur à l’addresse #{DEMANDE_INSCRIPTION_ADMIN_PAGE_URL}." return end diff --git a/app/models/champs/repetition_champ.rb b/app/models/champs/repetition_champ.rb index d95c917ff..3d53a48ad 100644 --- a/app/models/champs/repetition_champ.rb +++ b/app/models/champs/repetition_champ.rb @@ -53,7 +53,7 @@ class Champs::RepetitionChamp < Champ def libelle_for_export str = "(#{stable_id}) #{libelle}" # /\*?[] are invalid Excel worksheet characters - ActiveStorage::Filename.new(str.delete('[]*?')).sanitized.truncate(30) + ActiveStorage::Filename.new(str.delete('[]*?')).sanitized end class Row < Hashie::Dash diff --git a/app/models/export.rb b/app/models/export.rb index 39f9e107b..508c63792 100644 --- a/app/models/export.rb +++ b/app/models/export.rb @@ -24,7 +24,7 @@ class Export < ApplicationRecord scope :stale, -> { where('updated_at < ?', (Time.zone.now - MAX_DUREE_CONSERVATION_EXPORT)) } - after_create :compute_async + after_save_commit :compute_async def compute_async ExportJob.perform_later(self) diff --git a/app/services/procedure_export_service.rb b/app/services/procedure_export_service.rb index 4e7a79778..66a325a66 100644 --- a/app/services/procedure_export_service.rb +++ b/app/services/procedure_export_service.rb @@ -62,7 +62,7 @@ class ProcedureExportService } def options_for(table, format) - case table + options = case table when :dossiers { instances: dossiers.to_a, sheet_name: 'Dossiers', spreadsheet_columns: :"spreadsheet_columns_#{format}" } when :etablissements @@ -72,5 +72,8 @@ class ProcedureExportService when Array { instances: table.last, sheet_name: table.first } end.merge(DEFAULT_STYLES) + + options[:sheet_name] = options[:sheet_name].truncate(30) + options end end diff --git a/config/routes.rb b/config/routes.rb index 23b83dae0..fc8eec97d 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -423,6 +423,7 @@ Rails.application.routes.draw do # # Legacy routes # + get 'demandes/new' => redirect(DEMANDE_INSCRIPTION_ADMIN_PAGE_URL) get 'backoffice' => redirect('/procedures') get 'backoffice/sign_in' => redirect('/users/sign_in') diff --git a/spec/services/procedure_export_service_spec.rb b/spec/services/procedure_export_service_spec.rb index 34f140986..741f9bdd1 100644 --- a/spec/services/procedure_export_service_spec.rb +++ b/spec/services/procedure_export_service_spec.rb @@ -356,6 +356,21 @@ describe ProcedureExportService do end end + context 'with long libelle' do + before do + procedure.types_de_champ.each do |c| + c.update!(libelle: "#{c.id} - Quam rem nam maiores numquam dolorem nesciunt. Cum et possimus et aut. Fugit voluptas qui qui.") + end + champ_repetition.champs.each do |c| + c.type_de_champ.update!(libelle: "#{c.id} - Quam rem nam maiores numquam dolorem nesciunt. Cum et possimus et aut. Fugit voluptas qui qui.") + end + end + + it 'should have valid sheet name' do + expect { subject }.not_to raise_error(ArgumentError) + end + end + context 'with non unique labels' do let(:dossier) { create(:dossier, :en_instruction, :with_all_champs, :with_individual, procedure: procedure) } let(:champ_repetition) { dossier.champs.find { |champ| champ.type_champ == 'repetition' } }