From 142ed6f762c2facfbedc3ccbc7947102d2cb3107 Mon Sep 17 00:00:00 2001 From: Colin Darie Date: Tue, 9 Jul 2024 12:48:53 +0200 Subject: [PATCH] fix(cojo): fetch external data when "-01" suffix is typed, even if its deleted later by .to_i --- app/models/champs/cojo_champ.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/champs/cojo_champ.rb b/app/models/champs/cojo_champ.rb index 514db2a8e..3a356e838 100644 --- a/app/models/champs/cojo_champ.rb +++ b/app/models/champs/cojo_champ.rb @@ -50,7 +50,7 @@ class Champs::COJOChamp < Champ def update_external_id if accreditation_number_changed? || accreditation_birthdate_changed? - if accreditation_number.present? && accreditation_birthdate.present? && /\A\d+\z/.match?(accreditation_number) + if accreditation_number.present? && accreditation_birthdate.present? && /\A[\d-]+\z/.match?(accreditation_number) self.external_id = { accreditation_number:, accreditation_birthdate: }.to_json else self.external_id = nil