This commit is contained in:
2025-08-01 19:33:54 -03:00
parent f5bd1e80d6
commit 5c57da7ecb
4 changed files with 80 additions and 42 deletions

View File

@@ -46,21 +46,22 @@ def lambda_handler(event: EventBridgeEvent, context: LambdaContext) -> bool:
data = enrollment_layer.collection.get_items(
TransactKey(enrollment_id) + SortKey('0') + SortKey('author')
)
created_at: datetime = fromisoformat(data['create_date']) # type: ignore
if not data:
logger.debug('Enrollment not found')
return False
logger.info('Enrollment found', data=data)
# Keep it until the migration has been completed
old_course = _get_course(data['course']['id'])
if old_course:
data['course'] = old_course
created_at: datetime = fromisoformat(data['create_date']) # type: ignore
start_date, end_date = get_billing_period(
new_image['billing_day'],
year=created_at.year,
month=created_at.month,
billing_day=new_image['billing_day'],
date_=created_at,
)
pk = 'BILLING#ORG#{org_id}'.format(org_id=org_id)
sk = 'START#{start}#END#{end}'.format(