update create_date field
This commit is contained in:
@@ -23,7 +23,7 @@ dyn = DynamoDBPersistenceLayer(ENROLLMENT_TABLE, dynamodb_client)
|
|||||||
|
|
||||||
@app.post('/')
|
@app.post('/')
|
||||||
@tracer.capture_method
|
@tracer.capture_method
|
||||||
def update_enrollment():
|
def postback():
|
||||||
json_body = app.current_event.json_body
|
json_body = app.current_event.json_body
|
||||||
|
|
||||||
status = json_body['status']
|
status = json_body['status']
|
||||||
|
|||||||
@@ -65,6 +65,7 @@ def update_progress(
|
|||||||
':progress': progress,
|
':progress': progress,
|
||||||
':updated_at': now_,
|
':updated_at': now_,
|
||||||
},
|
},
|
||||||
|
exc_cls=EnrollmentConflictError,
|
||||||
)
|
)
|
||||||
# Record the start date if it does not already exist
|
# Record the start date if it does not already exist
|
||||||
transact.put(
|
transact.put(
|
||||||
@@ -140,7 +141,9 @@ def set_score(
|
|||||||
user_id=user_id,
|
user_id=user_id,
|
||||||
course_id=course_id,
|
course_id=course_id,
|
||||||
cert_exp_interval=int(
|
cert_exp_interval=int(
|
||||||
glom(enrollment, 'metadata__course.cert.exp_interval')
|
glom(
|
||||||
|
enrollment, 'metadata__course.cert.exp_interval', default=0
|
||||||
|
)
|
||||||
),
|
),
|
||||||
dedup_window_offset_days=int(
|
dedup_window_offset_days=int(
|
||||||
enrollment['dedup_window_offset_days']
|
enrollment['dedup_window_offset_days']
|
||||||
@@ -216,6 +219,8 @@ def _set_status_as_completed(
|
|||||||
},
|
},
|
||||||
cond_expr='attribute_not_exists(sk)',
|
cond_expr='attribute_not_exists(sk)',
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if cert_exp_interval:
|
||||||
transact.put(
|
transact.put(
|
||||||
item={
|
item={
|
||||||
'id': id,
|
'id': id,
|
||||||
@@ -249,6 +254,7 @@ def _set_status_as_completed(
|
|||||||
'created_at': now_,
|
'created_at': now_,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
# Remove reminders and policies that no longer apply
|
# Remove reminders and policies that no longer apply
|
||||||
transact.delete(
|
transact.delete(
|
||||||
key=KeyPair(
|
key=KeyPair(
|
||||||
@@ -420,4 +426,6 @@ class EnrollmentNotFoundError(NotFoundError):
|
|||||||
super().__init__('Enrollment not found')
|
super().__init__('Enrollment not found')
|
||||||
|
|
||||||
|
|
||||||
class EnrollmentConflictError(BadRequestError): ...
|
class EnrollmentConflictError(BadRequestError):
|
||||||
|
def __init__(self, *_):
|
||||||
|
super().__init__('Enrollment conflict')
|
||||||
|
|||||||
Reference in New Issue
Block a user