task: ensure that hidden dossiers are rolled back

This commit is contained in:
Pierre de La Morinerie 2019-06-18 15:06:26 +00:00
parent d71b3ade80
commit d561936863
2 changed files with 17 additions and 1 deletions

View file

@ -141,7 +141,7 @@ class PieceJustificativeToChampPieceJointeMigrationService
# First destroy all the individual champs on dossiers
type_champ.champ.each do |champ|
begin
destroy_champ_pj(champ.dossier.reload, champ)
destroy_champ_pj(Dossier.unscope(where: :hidden_at).find(champ.dossier_id), champ)
rescue => e
rake_puts e
rake_puts "Rolling back of champ #{champ.id} failed. Continuing to roll back…"