Skip to content

Update certificate to show issue date#3271

Merged
annagav merged 8 commits into
mainfrom
ag/issue_date
Feb 23, 2026
Merged

Update certificate to show issue date#3271
annagav merged 8 commits into
mainfrom
ag/issue_date

Conversation

@annagav
Copy link
Copy Markdown
Contributor

@annagav annagav commented Feb 5, 2026

What are the relevant tickets?

Related to https://github.com/mitodl/mitxonline/pull/3025/changes

Description (What does it do?)

Update certificate to show issue date

Screenshots (if appropriate):

Screenshot 2026-02-04 at 9 34 21 PM

How can this be tested?

Created a certificate, go to view it

Make sure that the date shown is the issue date.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Feb 5, 2026

OpenAPI Changes

Show/hide ## Changes for v0.yaml:
## Changes for v0.yaml:


## Changes for v1.yaml:


## Changes for v2.yaml:


Unexpected changes? Ensure your branch is up-to-date with main (consider rebasing).

@rachellougee rachellougee self-assigned this Feb 5, 2026
Copy link
Copy Markdown
Contributor

@rachellougee rachellougee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The certificate now displays issue_date when it's set, but shows empty when it isn't. Since issue_date is not required, we should add a default value.

Image

Comment thread cms/models.py
"learner_name": self.certificate.user.get_full_name(),
"start_date": start_date,
"end_date": end_date,
"issue_date": self.certificate.issue_date,
Copy link
Copy Markdown
Contributor

@rachellougee rachellougee Feb 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This works if issue_date is set, but over 2000 certificates don't have an issue_date, can we add a default? maybe created_on?

e.g. https://mitxonline.mit.edu/admin/courses/courseruncertificate/59293/change/

@annagav annagav force-pushed the ag/issue_date branch 3 times, most recently from f9e8cdb to c1b248e Compare February 19, 2026 17:28
@annagav annagav requested a review from rachellougee February 20, 2026 01:01
Copy link
Copy Markdown
Contributor

@rachellougee rachellougee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me

Comment on lines +8 to +11
for certificate in CourseRunCertificate.objects.all():
if certificate.issue_date is None:
certificate.issue_date = certificate.created_on
certificate.save(update_fields=["issue_date"])
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a suggestion for performance: this can be done in one query. But since you've handled similar migration before, its likely fine as is

  CourseRunCertificate.objects.filter(
        issue_date__isnull=True
    ).update(issue_date=models.F("created_on"))

@annagav annagav requested a review from rachellougee February 23, 2026 18:57
Copy link
Copy Markdown
Contributor

@rachellougee rachellougee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks for the change.

@annagav annagav merged commit b9c2458 into main Feb 23, 2026
10 checks passed
@annagav annagav deleted the ag/issue_date branch February 23, 2026 19:17
@odlbot odlbot mentioned this pull request Feb 23, 2026
7 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants