Merge pull request #1971 from betagouv/fix_1952_improve_dubious_procedure
Fix 1952 improve dubious procedure
This commit is contained in:
commit
6303372b3e
4 changed files with 25 additions and 5 deletions
|
@ -2,8 +2,9 @@ class FindDubiousProceduresJob < ApplicationJob
|
||||||
queue_as :cron
|
queue_as :cron
|
||||||
|
|
||||||
FORBIDDEN_KEYWORDS = [
|
FORBIDDEN_KEYWORDS = [
|
||||||
'IBAN', 'NIR', 'NIRPP', 'race', 'religion',
|
'NIR', 'NIRPP', 'race', 'religion',
|
||||||
'carte bancaire', 'carte bleue', 'sécurité sociale'
|
'carte bancaire', 'carte bleue', 'sécurité sociale', 'nationalité',
|
||||||
|
'agdref', 'handicap', 'syndicat', 'politique'
|
||||||
]
|
]
|
||||||
|
|
||||||
def perform(*args)
|
def perform(*args)
|
||||||
|
|
|
@ -3,9 +3,16 @@
|
||||||
- if @procedures_and_type_de_champs.any?
|
- if @procedures_and_type_de_champs.any?
|
||||||
%ul
|
%ul
|
||||||
- @procedures_and_type_de_champs.each do |procedure, type_de_champs|
|
- @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)
|
= link_to "Nº #{procedure.id},", manager_procedure_url(procedure)
|
||||||
#{procedure.libelle} :
|
#{procedure.libelle} :
|
||||||
%b= type_de_champs.map(&:libelle).join(', ')
|
%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
|
- else
|
||||||
Il n'y a aucune procédure douteuse aujourd'hui
|
Il n'y a aucune procédure douteuse aujourd'hui
|
||||||
|
|
|
@ -119,6 +119,12 @@ FactoryBot.define do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
trait :whitelisted do
|
||||||
|
after(:build) do |procedure, _evaluator|
|
||||||
|
procedure.update(whitelisted_at: DateTime.now)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
trait :with_notice do
|
trait :with_notice do
|
||||||
after(:create) do |procedure, _evaluator|
|
after(:create) do |procedure, _evaluator|
|
||||||
procedure.notice.attach(
|
procedure.notice.attach(
|
||||||
|
|
|
@ -35,13 +35,19 @@ RSpec.describe FindDubiousProceduresJob, type: :job do
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'and a whitelisted procedure' do
|
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([]) }
|
it { expect(AdministrationMailer).to have_received(:dubious_procedures).with([]) }
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'and a archived procedure' do
|
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([]) }
|
it { expect(AdministrationMailer).to have_received(:dubious_procedures).with([]) }
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue