update events
This commit is contained in:
@@ -27,6 +27,8 @@ def lambda_handler(event: EventBridgeEvent, context: LambdaContext) -> bool:
|
||||
enrollment_id = new_image['id']
|
||||
user = new_image['user']
|
||||
course_name = glom(new_image, 'course.name')
|
||||
# Post-migration: after removing the stopgap file `patch_course_metadata.py`,
|
||||
# use `access_expires_at` from `new_image`
|
||||
access_period = int(
|
||||
dyn.collection.get_item(
|
||||
KeyPair(
|
||||
@@ -49,20 +51,16 @@ def lambda_handler(event: EventBridgeEvent, context: LambdaContext) -> bool:
|
||||
},
|
||||
)
|
||||
|
||||
# By default, the enrollment will expire when the access period ends
|
||||
# (scheduled below).
|
||||
|
||||
# If the enrollment is completed earlier (e.g., certificate issued),
|
||||
# the expiration schedule is canceled and an archive schedule
|
||||
# (`SCHEDULE#SET_AS_ARCHIVED`) is created instead.
|
||||
# Schedule the event to add `access_expired` after the access period ends
|
||||
transact.put(
|
||||
item={
|
||||
'id': enrollment_id,
|
||||
'sk': 'SCHEDULE#SET_AS_EXPIRED',
|
||||
'sk': 'SCHEDULE#SET_ACCESS_EXPIRED',
|
||||
'created_at': now_,
|
||||
'ttl': ttl(start_dt=now_, days=access_period),
|
||||
},
|
||||
)
|
||||
|
||||
transact.put(
|
||||
item={
|
||||
'id': enrollment_id,
|
||||
|
||||
Reference in New Issue
Block a user