From bf8ec34fcd8814ac6845a5a81b0c8e3ca9c330dc Mon Sep 17 00:00:00 2001 From: Henry Date: Tue, 18 Jun 2024 09:43:14 -0400 Subject: [PATCH] Update reg datum on person sync --- app/controllers/people_controller.rb | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/app/controllers/people_controller.rb b/app/controllers/people_controller.rb index 064bff185..a0956c6ca 100644 --- a/app/controllers/people_controller.rb +++ b/app/controllers/people_controller.rb @@ -43,10 +43,28 @@ def clyde_sync IdentityService.update_reg_info(person: person, details: details['data']) + # Also need to update the datum + update_datum(details['data']) + render_object(person) end end + def update_datum(data) + datum = RegistrationSyncDatum.find_by reg_id: data['id'] + if datum + datum.update( + name: data['full_name']&.strip, + email: data['email']&.strip, + registration_number: data['ticket_number']&.strip, + preferred_name: data['preferred_name']&.strip, + alternative_email: data['alternative_email']&.strip, + badge_name: data['badge']&.strip, + raw_info: data + ) + end + end + def unlink_registration authorize current_person, policy_class: policy_class