fix enroll and reenroll relationship

This commit is contained in:
2025-10-14 18:11:24 -03:00
parent 466ff824dd
commit a7e5a0a528
20 changed files with 125 additions and 89 deletions

View File

@@ -55,7 +55,7 @@ def update_progress(
key=KeyPair(id, '0'),
update_expr='SET progress = :progress, \
#status = :in_progress, \
started_at = :now, \
started_at = if_not_exists(started_at, :now), \
updated_at = :now',
cond_expr='#status = :pending',
expr_attr_names={
@@ -69,15 +69,6 @@ def update_progress(
},
exc_cls=EnrollmentConflictError,
)
# Record the start date if it does not already exist
transact.put(
item={
'id': id,
'sk': 'STARTED',
'created_at': now_,
},
cond_expr='attribute_not_exists(sk)',
)
# Schedule a reminder for inactivity
transact.put(
item={
@@ -192,7 +183,7 @@ def _set_status_as_completed(
update_expr='SET #status = :completed, \
progress = :progress, \
score = :score, \
completed_at = :now, \
completed_at = if_not_exists(completed_at, :now), \
updated_at = :now',
cond_expr='#status = :in_progress',
expr_attr_names={'#status': 'status'},
@@ -205,14 +196,6 @@ def _set_status_as_completed(
},
exc_cls=EnrollmentConflictError,
)
transact.put(
item={
'id': id,
'sk': 'COMPLETED',
'created_at': now_,
},
cond_expr='attribute_not_exists(sk)',
)
if cert_exp_interval:
transact.put(
@@ -293,7 +276,7 @@ def _set_status_as_failed(
progress = :progress, \
score = :score, \
access_expired = :true, \
failed_at = :now, \
failed_at = if_not_exists(failed_at, :now), \
updated_at = :now',
cond_expr='#status = :in_progress',
expr_attr_names={'#status': 'status'},