Merge pull request #5625 from betagouv/dev

2020-09-25-01
This commit is contained in:
Keirua 2020-09-25 08:58:41 +02:00 committed by GitHub
commit eb27f8ac3e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 38 additions and 5 deletions

14
.github/dependabot.yml vendored Normal file
View file

@ -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"

View file

@ -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)

View file

@ -11,7 +11,7 @@ module NewAdministrateur
# Find the admin
administrateur = Administrateur.by_email(email)
if administrateur.nil?
flash.alert = "Ladministrateur « #{email} » nexiste pas. Invitez-le à demander un compte administrateur à laddresse <a href=#{new_demande_url}>#{new_demande_url}</a>."
flash.alert = "Ladministrateur « #{email} » nexiste pas. Invitez-le à demander un compte administrateur à laddresse <a href=#{DEMANDE_INSCRIPTION_ADMIN_PAGE_URL}>#{DEMANDE_INSCRIPTION_ADMIN_PAGE_URL}</a>."
return
end

View file

@ -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

View file

@ -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)

View file

@ -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

View file

@ -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')

View file

@ -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' } }