Release 1.166.7 - #3985
Merged
Merged
Release 1.166.7#3985
Conversation
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
…3978) Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
Comment on lines
+1454
to
1457
| amount=100, | ||
| ) | ||
|
|
||
| if existing_discount_qs.exists(): |
Contributor
There was a problem hiding this comment.
Bug: The new, more restrictive filter for program discounts may fail to find pre-existing, manually-edited discounts, leading to the creation of duplicates.
Severity: LOW
Suggested Fix
To prevent creating duplicates, the lookup for existing program discounts should be less restrictive. Consider only filtering by a unique, immutable identifier for program discounts, such as redemption_type=REDEMPTION_TYPE_INTERNAL. Alternatively, if the discount_type and amount must be fixed, add a data migration to normalize any existing, manually-edited program discounts to match the new expected values.
Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.
Location: ecommerce/api.py#L1454-L1457
Potential issue: The logic to find an existing program discount was changed to filter on
`redemption_type=INTERNAL`, `discount_type=DISCOUNT_TYPE_PERCENT_OFF`, and `amount=100`.
Previously, the lookup was less restrictive. If a program discount was manually edited
in the admin panel to have a different `discount_type` or `amount` before this change,
the new, more restrictive filter will fail to find it. This will cause the system to
create a duplicate discount for the program, which could cause issues in the critical
enrollment flow.
Did we get this right? 👍 / 👎 to inform future reviews.
blarghmatey
force-pushed
the
release
branch
from
September 17, 2026 19:36
11b4f56 to
f7cfdf6
Compare
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.
Chris Chudzicki