fix(data): update procedures with invalid mon avis
This commit is contained in:
parent
94f37b6708
commit
0a00d801bc
2 changed files with 17 additions and 2 deletions
|
@ -0,0 +1,15 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module Maintenance
|
||||
class DisableRemainingInvalidMonAvisTask < MaintenanceTasks::Task
|
||||
def collection
|
||||
# rubocop:disable DS/Unscoped
|
||||
Procedure.unscoped.where.not(monavis_embed: nil)
|
||||
# rubocop:enable DS/Unscoped
|
||||
end
|
||||
|
||||
def process(procedure)
|
||||
procedure.update_column(:monavis_embed, '') if !procedure.valid? && procedure.errors.key?(:monavis_embed)
|
||||
end
|
||||
end
|
||||
end
|
|
@ -13,9 +13,9 @@ class MonAvisEmbedValidator < ActiveModel::Validator
|
|||
check_img(embed.css('img'))
|
||||
end
|
||||
rescue MonAvisEmbedError => e
|
||||
record.errors.add :base, :invalid, message: "Le code fourni ne correspond pas au format des codes MonAvis reconnus par la plateforme. #{e.message}"
|
||||
record.errors.add :monavis_embed, :invalid, message: "Le code fourni ne correspond pas au format des codes MonAvis reconnus par la plateforme. #{e.message}"
|
||||
rescue # nokogiri
|
||||
record.errors.add :base, :invalid, message: "Le code fourni ne correspond pas au format des codes MonAvis reconnus par la plateforme."
|
||||
record.errors.add :monavis_embed, :invalid, message: "Le code fourni ne correspond pas au format des codes MonAvis reconnus par la plateforme."
|
||||
end
|
||||
|
||||
def check_link(links)
|
||||
|
|
Loading…
Reference in a new issue