remove archived and expired

This commit is contained in:
2025-09-18 12:24:21 -03:00
parent 0ebf108a94
commit db63dfa64d
8 changed files with 134 additions and 232 deletions

View File

@@ -26,7 +26,7 @@ dyn = DynamoDBPersistenceLayer(ENROLLMENT_TABLE, dynamodb_client)
def postback():
json_body = app.current_event.json_body
status = json_body['status']
event_name = json_body['event_name']
score = round(Decimal(json_body['APROVEITAMENTO']), 2)
progress = round(Decimal(json_body['ANDAMENTO']), 2)
enrollment_id = dyn.collection.get_item(
@@ -34,16 +34,29 @@ def postback():
# Post-migration: uncomment the following line
# pk='KONVIVA',
pk='konviva',
sk=SortKey(json_body['ID_MATRICULA'], path_spec='enrollment_id'),
sk=SortKey(
json_body['ID_MATRICULA'],
path_spec='enrollment_id',
),
),
exc_cls=EnrollmentNotFoundError,
)
if status == 'IN_PROGRESS':
update_progress(enrollment_id, progress, dynamodb_persistence_layer=dyn)
if status == 'COMPLETED':
set_score(enrollment_id, score, progress, dynamodb_persistence_layer=dyn)
# Make sure webhooks send the correct event names
match event_name:
case 'UPDATING':
update_progress(
enrollment_id,
progress,
dynamodb_persistence_layer=dyn,
)
case 'COMPLETED':
set_score(
enrollment_id,
score,
progress,
dynamodb_persistence_layer=dyn,
)
return Response(status_code=HTTPStatus.NO_CONTENT)