More updates for Cvent and IDAA custom status field. Only using pending status if it is specificially passed. Otherwise using unknown or whatever is passed.

This commit is contained in:
Scott Idem
2022-03-16 09:25:32 -04:00
parent 6a969e0991
commit 212d69cbe3
2 changed files with 17 additions and 16 deletions

View File

@@ -632,20 +632,21 @@ def create_update_aether_person(
membership_person_type_data['last_end_on'] = datetime.datetime.strptime(cvent_contact_obj.get('membership').get('expiration'), '%Y-%m-%d')
current_datetime = datetime.datetime.now()
log.debug(status)
if status == 'unknown':
log.debug(current_datetime)
buffer_datetime = current_datetime - datetime.timedelta(minutes=1440) # 720 min = 12 hours
log.debug(buffer_datetime)
log.debug(membership_person_type_data['first_start_on'])
log.info('Status is unknown. Going to try and make a guess...')
if membership_person_type_data['first_start_on'] < buffer_datetime and membership_person_type_data['end_on'] >= current_datetime:
person_data['status'] = 'approved' # approved and current
elif membership_person_type_data['first_start_on'] < current_datetime and membership_person_type_data['end_on'] < current_datetime:
person_data['status'] = 'approved' # approved but expired
else:
person_data['status'] = 'pending' # likely new?
log.debug(person_data['status'])
# log.debug(status)
# if status == 'unknown':
# log.debug(current_datetime)
# buffer_datetime = current_datetime - datetime.timedelta(minutes=1440) # 720 min = 12 hours
# log.debug(buffer_datetime)
# log.debug(membership_person_type_data['first_start_on'])
# log.info('Status is unknown. Going to try and make a guess...')
# if membership_person_type_data['first_start_on'] < buffer_datetime and membership_person_type_data['end_on'] >= current_datetime:
# person_data['status'] = 'approved' # approved and current
# elif membership_person_type_data['first_start_on'] < current_datetime and membership_person_type_data['end_on'] < current_datetime:
# person_data['status'] = 'approved' # approved but expired
# else:
# person_data['status'] = 'pending' # likely new?
# log.debug(person_data['status'])
if membership_person_type_data['end_on'] >= current_datetime:
membership_person_type_data['lu_membership_type_status_id'] = 5 # 5 = active; expiration is > now