Impexium updates for address fields

This commit is contained in:
2022-04-21 09:21:30 -04:00
parent a789cf2705
commit 427a1dee07

View File

@@ -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