From 427a1dee078c7cce6f79c91d0608414fc677fb9d Mon Sep 17 00:00:00 2001 From: Scott Idem Date: Thu, 21 Apr 2022 09:21:30 -0400 Subject: [PATCH] Impexium updates for address fields --- app/routers/e_impexium.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/app/routers/e_impexium.py b/app/routers/e_impexium.py index 941b531..d01f07b 100644 --- a/app/routers/e_impexium.py +++ b/app/routers/e_impexium.py @@ -91,6 +91,7 @@ async def event_import_reg( # event_person_data['external_id_old'] = external_id_old email = None + city = None country_subdivision_code = None state_province = None state_province_abb = None @@ -106,6 +107,7 @@ async def event_import_reg( if isinstance(addresses, list) and len(addresses): for address in addresses: if primary_address := address.get('primary'): + city = address.get('city') country_subdivision_code = address.get('stateISOCode') state_province = address.get('state') state_province_abb = address.get('stateAbbreviation') @@ -322,6 +324,8 @@ async def event_import_reg( event_badge_data['city'] = event_registrant.get('badgeCity') event_badge_data['state_province'] = event_registrant.get('badgeState') + if not event_badge_data['city'] and city: + event_badge_data['city'] = city if country_subdivision_code: event_badge_data['country_subdivision_code'] = country_subdivision_code if not event_badge_data['state_province'] and state_province: @@ -347,6 +351,11 @@ async def event_import_reg( elif event_badge_data['city'] and country: city = event_badge_data['city'] location = f'{city}, {country}' + elif event_badge_data['city']: + city = event_badge_data['city'] + location = f'{city}' + elif country: + location = f'{country}' if location: event_badge_data['location'] = location