fix(fix_champs_commune_having_value_but_not_external_id): only asks for update for dossier en construction
This commit is contained in:
parent
ada5ceeeec
commit
3b3c845b2e
3 changed files with 11 additions and 9 deletions
|
@ -26,6 +26,7 @@ module Maintenance
|
||||||
champ.code = formated_results.first[:value]
|
champ.code = formated_results.first[:value]
|
||||||
champ.save!
|
champ.save!
|
||||||
else # otherwise, we can't find the expected departement
|
else # otherwise, we can't find the expected departement
|
||||||
|
if champ.dossier.en_construction?
|
||||||
champ.code_departement = nil
|
champ.code_departement = nil
|
||||||
champ.code_postal = nil
|
champ.code_postal = nil
|
||||||
champ.external_id = nil
|
champ.external_id = nil
|
||||||
|
@ -36,6 +37,7 @@ module Maintenance
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def count
|
def count
|
||||||
# osf, count is not an option
|
# osf, count is not an option
|
||||||
|
|
|
@ -30,7 +30,7 @@ module Maintenance
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'en_instruction (go back to en_construction!), send comment' do
|
context 'en_instruction (go back to en_construction!), send comment' do
|
||||||
let(:state) { [:en_instruction, :en_construction].sample }
|
let(:state) { :en_construction }
|
||||||
|
|
||||||
it 'flags as pending correction' do
|
it 'flags as pending correction' do
|
||||||
expect { subject }.to change { champ.reload.value }.from('Marseille').to(nil)
|
expect { subject }.to change { champ.reload.value }.from('Marseille').to(nil)
|
||||||
|
|
|
@ -6,7 +6,7 @@ module Maintenance
|
||||||
RSpec.describe ResolvePendingCorrectionForDossierWithInvalidCommuneExternalIdTask do
|
RSpec.describe ResolvePendingCorrectionForDossierWithInvalidCommuneExternalIdTask do
|
||||||
describe "#process" do
|
describe "#process" do
|
||||||
subject(:process) { described_class.process }
|
subject(:process) { described_class.process }
|
||||||
let(:instructeur) { create(:instructeur, email: ENV.fetch('DEFAULT_INSTRUCTEUR_EMAIL') { CONTACT_EMAIL }) }
|
let!(:instructeur) { create(:instructeur, email: ENV.fetch('DEFAULT_INSTRUCTEUR_EMAIL') { CONTACT_EMAIL }) }
|
||||||
let(:commentaire) { create(:commentaire, instructeur:) }
|
let(:commentaire) { create(:commentaire, instructeur:) }
|
||||||
let(:dossier_correction) { create(:dossier_correction, commentaire:, dossier:, resolved_at: nil) }
|
let(:dossier_correction) { create(:dossier_correction, commentaire:, dossier:, resolved_at: nil) }
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@ module Maintenance
|
||||||
|
|
||||||
context 'when dossier didnt transitioned' do
|
context 'when dossier didnt transitioned' do
|
||||||
let(:dossier) { create(:dossier, :en_construction) }
|
let(:dossier) { create(:dossier, :en_construction) }
|
||||||
|
before { create(:traitement, dossier:) }
|
||||||
it 'noop' do
|
it 'noop' do
|
||||||
expect { subject }.not_to change { dossier.reload.state }
|
expect { subject }.not_to change { dossier.reload.state }
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Reference in a new issue