Modified Impexium import to pull in state whereever possible

This commit is contained in:
2022-04-20 16:39:40 -04:00
parent d2e81bb488
commit 229f06cefa

View File

@@ -92,6 +92,7 @@ async def event_import_reg(
email = None email = None
country_subdivision_code = None country_subdivision_code = None
state_province = None
state_province_abb = None state_province_abb = None
country_alpha_2_code = None country_alpha_2_code = None
country = None country = None
@@ -106,6 +107,7 @@ async def event_import_reg(
for address in addresses: for address in addresses:
if primary_address := address.get('primary'): if primary_address := address.get('primary'):
country_subdivision_code = address.get('stateISOCode') country_subdivision_code = address.get('stateISOCode')
state_province = address.get('state')
state_province_abb = address.get('stateAbbreviation') state_province_abb = address.get('stateAbbreviation')
if country_data := address.get('countryData'): if country_data := address.get('countryData'):
@@ -322,6 +324,8 @@ async def event_import_reg(
if country_subdivision_code: if country_subdivision_code:
event_badge_data['country_subdivision_code'] = country_subdivision_code event_badge_data['country_subdivision_code'] = country_subdivision_code
if not event_badge_data['state_province'] and state_province:
event_badge_data['state_province'] = state_province
if state_province_abb: if state_province_abb:
event_badge_data['state_province_abb'] = state_province_abb event_badge_data['state_province_abb'] = state_province_abb
if country_alpha_2_code: if country_alpha_2_code: