diff --git a/app/jobs/find_dubious_procedures_job.rb b/app/jobs/find_dubious_procedures_job.rb index 8f399f672..13c9a91ab 100644 --- a/app/jobs/find_dubious_procedures_job.rb +++ b/app/jobs/find_dubious_procedures_job.rb @@ -24,7 +24,7 @@ class FindDubiousProceduresJob < CronJob .where(procedures: { closed_at: nil, whitelisted_at: nil }) dubious_procedures_and_tdcs = forbidden_tdcs - .group_by(&:procedure_id) + .group_by { |type_de_champ| type_de_champ.procedure.id } .map { |_procedure_id, tdcs| [tdcs[0].procedure, tdcs] } AdministrationMailer.dubious_procedures(dubious_procedures_and_tdcs).deliver_later diff --git a/app/models/type_de_champ.rb b/app/models/type_de_champ.rb index c308f397a..e0ff6990d 100644 --- a/app/models/type_de_champ.rb +++ b/app/models/type_de_champ.rb @@ -18,6 +18,8 @@ # stable_id :bigint # class TypeDeChamp < ApplicationRecord + self.ignored_columns = ['procedure_id'] + enum type_champs: { text: 'text', textarea: 'textarea',