Skip to content

Commit

Permalink
override archived status and show continue button
Browse files Browse the repository at this point in the history
  • Loading branch information
usamabinnadeem-10 committed Jun 25, 2024
1 parent 5c3ee77 commit da1ed3a
Showing 1 changed file with 17 additions and 5 deletions.
22 changes: 17 additions & 5 deletions webapp/shop/cred/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -511,16 +511,25 @@ def cred_your_exams(ua_contracts_api, trueability_api, **kwargs):
else:
state = RESERVATION_STATES.get(r["state"], r["state"])

state = (
RESERVATION_STATES["finalized"]
if state
in [
RESERVATION_STATES["archived"],
RESERVATION_STATES["archiving"],
]
else state
)
# if assessment is provisioned
if assessment_id:
is_in_window = (now > starts_at and now < end) or (
now < starts_at
and now > starts_at - timedelta(minutes=30)
)
provisioned_but_not_taken = (
is_in_window
and state == RESERVATION_STATES["provisioned"]
)
provisioned_but_not_taken = is_in_window and state in [
RESERVATION_STATES["notified"],
RESERVATION_STATES["provisioned"],
]

if (
state == RESERVATION_STATES["in_progress"]
Expand All @@ -529,7 +538,10 @@ def cred_your_exams(ua_contracts_api, trueability_api, **kwargs):
actions.extend(
[
{
"text": "Take exam",
"text": "Continue exam"
if state
== RESERVATION_STATES["in_progress"]
else "Take exam",
"href": "/credentials/exam?"
f"id={assessment_id}",
"button_class": "p-button--positive",
Expand Down

0 comments on commit da1ed3a

Please sign in to comment.