Skip to content

Commit

Permalink
fix: revamp status_changed for back-compat
Browse files Browse the repository at this point in the history
  • Loading branch information
ilee2u committed Sep 26, 2024
1 parent f2aec0b commit 2654117
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lms/djangoapps/verify_student/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ def update_verification_attempt(
'Status must be one of: %(status_list)s',
{
'status': status,
'status_list': VerificationAttempt.STATUS,
'status_list': VerificationAttempt.STATUS_CHOICES,
},
)
raise VerificationAttemptInvalidStatus
Expand Down
13 changes: 10 additions & 3 deletions lms/djangoapps/verify_student/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -1224,12 +1224,14 @@ class VerificationAttempt(TimeStampedModel, StatusModel):
user = models.ForeignKey(User, db_index=True, on_delete=models.CASCADE)
name = models.CharField(blank=True, max_length=255)

STATUS = Choices(
# VerificationAttemptStatus.CREATED,
STATUS_CHOICES = [
VerificationAttemptStatus.CREATED,
VerificationAttemptStatus.PENDING,
VerificationAttemptStatus.APPROVED,
VerificationAttemptStatus.DENIED,
)
]

status = models.CharField(max_length=64, choices=[(status, status) for status in STATUS_CHOICES])

expiration_datetime = models.DateTimeField(
null=True,
Expand All @@ -1245,6 +1247,11 @@ def should_display_status_to_user(self):
"""When called, returns true or false based on the type of VerificationAttempt"""
return not self.hide_status_from_user

@property
def status_changed(self):
"""Backwards compatibility with existing IDVerification models"""
return self.modified

@property
def updated_at(self):
"""Backwards compatibility with existing IDVerification models"""
Expand Down

0 comments on commit 2654117

Please sign in to comment.