Fix certificate generation for nested programs to check the required program - #3858
Merged
jkachel merged 1 commit intoAug 18, 2026
Merged
Conversation
…h_ the requirement, not the program that was _required_
OpenAPI ChangesShow/hide changesUnexpected changes? Ensure your branch is up-to-date with |
annagav
self-requested a review
August 18, 2026 12:39
jkachel
deleted the
jkachel/12823-pt-2-fix-bugs-in-program-consideration
branch
August 18, 2026 15:06
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What are the relevant tickets?
mitodl/hq#12805
Description (What does it do?)
https://github.com/mitodl/hq/issues/12823 attempted to fix an issue with certificate generation for programs, wherein a program with a nested audit-only program wouldn't generate certificates because it was only looking for certificates (and audit programs never get those, so even if you passed the program you were out of luck). But, there was an error in this; it was looking at
node.programto get the required program, which is incorrect.This fixes the check to use
node.required_program, which is the program that is the requirement. (node.programis the program that the node belongs to.) Some additional debug logging is also now present so what it is doing is more obvious and traceable in the logs.In addition, the test for this was updated but it wasn't updated well enough, so it passed even when it shouldn't have. This was also fixed.
How can this be tested?
To get a test rig set up for this, I created:
Then, check
_has_earned_program_certin a Django shell:This should return
True.You should then also be able to generate the cert with a management command:
./manage.py manage_program_certificates --user theuser@odl.local --program program-v1:prog --createYou should be able to further test with failing grades or non-certificate courses:
The course behavior and considerations weren't changed in this PR and are covered by other tests so not strictly necessary to check them here.