diff --git a/app/jobs/find_dubious_procedures_job.rb b/app/jobs/find_dubious_procedures_job.rb index a1aa3dbba..22ac22f54 100644 --- a/app/jobs/find_dubious_procedures_job.rb +++ b/app/jobs/find_dubious_procedures_job.rb @@ -2,8 +2,9 @@ class FindDubiousProceduresJob < ApplicationJob queue_as :cron FORBIDDEN_KEYWORDS = [ - 'IBAN', 'NIR', 'NIRPP', 'race', 'religion', - 'carte bancaire', 'carte bleue', 'sécurité sociale' + 'NIR', 'NIRPP', 'race', 'religion', + 'carte bancaire', 'carte bleue', 'sécurité sociale', 'nationalité', + 'agdref', 'handicap', 'syndicat', 'politique' ] def perform(*args) diff --git a/app/views/administration_mailer/dubious_procedures.html.haml b/app/views/administration_mailer/dubious_procedures.html.haml index 2f90561c2..07a0c842d 100644 --- a/app/views/administration_mailer/dubious_procedures.html.haml +++ b/app/views/administration_mailer/dubious_procedures.html.haml @@ -3,9 +3,16 @@ - if @procedures_and_type_de_champs.any? %ul - @procedures_and_type_de_champs.each do |procedure, type_de_champs| - %li + %li{ style: 'margin-bottom: 8px;' } = link_to "Nº #{procedure.id},", manager_procedure_url(procedure)  #{procedure.libelle} : %b= type_de_champs.map(&:libelle).join(', ') + %br + État : #{procedure.aasm_state} + %br + Nombre de dossier : #{procedure.dossiers.count} + %br + Admin : + = link_to "#{procedure.administrateur.email}", "mailto:#{procedure.administrateur.email}" - else Il n'y a aucune procédure douteuse aujourd'hui diff --git a/app/views/new_gestionnaire/dossiers/_champs.html.haml b/app/views/new_gestionnaire/dossiers/_champs.html.haml index e980c11ec..a0e203778 100644 --- a/app/views/new_gestionnaire/dossiers/_champs.html.haml +++ b/app/views/new_gestionnaire/dossiers/_champs.html.haml @@ -51,7 +51,8 @@ = "#{c.libelle} :" %td.rich-text %span{ class: highlight_if_unseen_class(demande_seen_at, c.updated_at) } - = render partial: "new_gestionnaire/dossiers/identite_entreprise", locals: { etablissement: c.etablissement } + - if c.etablissement.present? + = render partial: "new_gestionnaire/dossiers/identite_entreprise", locals: { etablissement: c.etablissement } - else %th.libelle = "#{c.libelle} :" diff --git a/spec/factories/procedure.rb b/spec/factories/procedure.rb index 26446239d..233d655a0 100644 --- a/spec/factories/procedure.rb +++ b/spec/factories/procedure.rb @@ -119,6 +119,12 @@ FactoryBot.define do end end + trait :whitelisted do + after(:build) do |procedure, _evaluator| + procedure.update(whitelisted_at: DateTime.now) + end + end + trait :with_notice do after(:create) do |procedure, _evaluator| procedure.notice.attach( diff --git a/spec/jobs/find_dubious_procedures_job_spec.rb b/spec/jobs/find_dubious_procedures_job_spec.rb index 2c1fb450a..eddba63a3 100644 --- a/spec/jobs/find_dubious_procedures_job_spec.rb +++ b/spec/jobs/find_dubious_procedures_job_spec.rb @@ -35,13 +35,19 @@ RSpec.describe FindDubiousProceduresJob, type: :job do end context 'and a whitelisted procedure' do - let(:procedure) { create(:procedure, whitelisted_at: DateTime.now) } + let(:procedure) { create(:procedure, :whitelisted) } it { expect(AdministrationMailer).to have_received(:dubious_procedures).with([]) } end context 'and a archived procedure' do - let(:procedure) { create(:procedure, archived_at: DateTime.now) } + let(:procedure) { create(:procedure, :archived) } + + it { expect(AdministrationMailer).to have_received(:dubious_procedures).with([]) } + end + + context 'and a hidden procedure' do + let(:procedure) { create(:procedure, :hidden) } it { expect(AdministrationMailer).to have_received(:dubious_procedures).with([]) } end