Skip to content

fix: Overwrite allowances in special exams instead of creating a new …#38488

Merged
wgu-taylor-payne merged 2 commits intoopenedx:masterfrom
WGU-Open-edX:bugfix/194-allowance-replace-on-duplicate
May 1, 2026
Merged

fix: Overwrite allowances in special exams instead of creating a new …#38488
wgu-taylor-payne merged 2 commits intoopenedx:masterfrom
WGU-Open-edX:bugfix/194-allowance-replace-on-duplicate

Conversation

@brianjbuck-wgu
Copy link
Copy Markdown
Contributor

@brianjbuck-wgu brianjbuck-wgu commented Apr 30, 2026

Addresses item 1 of this issue: openedx/frontend-app-instructor-dashboard#194

The edx-proctoring model has a unique constraint on (user, proctored_exam, key) where key is the allowance type. The current implementation of the v2 endpoints respects that unique constraint. However, the v1 Instructor Dashboard only allows a learner to have a single allowance at a time regardless of the type. To match that behavior, this PR does an upsert that only allows a single allowance per learner overwriting a previous allowance if it exists even if its of a different key (type).

@openedx-webhooks openedx-webhooks added the open-source-contribution PR author is not from Axim or 2U label Apr 30, 2026
@openedx-webhooks
Copy link
Copy Markdown

openedx-webhooks commented Apr 30, 2026

Thanks for the pull request, @brianjbuck-wgu!

This repository is currently maintained by @openedx/wg-maintenance-openedx-platform.

Once you've gone through the following steps feel free to tag them in a comment and let them know that your changes are ready for engineering review.

🔘 Get product approval

If you haven't already, check this list to see if your contribution needs to go through the product review process.

  • If it does, you'll need to submit a product proposal for your contribution, and have it reviewed by the Product Working Group.
    • This process (including the steps you'll need to take) is documented here.
  • If it doesn't, simply proceed with the next step.
🔘 Provide context

To help your reviewers and other members of the community understand the purpose and larger context of your changes, feel free to add as much of the following information to the PR description as you can:

  • Dependencies

    This PR must be merged before / after / at the same time as ...

  • Blockers

    This PR is waiting for OEP-1234 to be accepted.

  • Timeline information

    This PR must be merged by XX date because ...

  • Partner information

    This is for a course on edx.org.

  • Supporting documentation
  • Relevant Open edX discussion forum threads
🔘 Get a green build

If one or more checks are failing, continue working on your changes until this is no longer the case and your build turns green.

Details
Where can I find more information?

If you'd like to get more details on all aspects of the review process for open source pull requests (OSPRs), check out the following resources:

When can I expect my changes to be merged?

Our goal is to get community contributions seen and reviewed as efficiently as possible.

However, the amount of time that it takes to review and merge a PR can vary significantly based on factors such as:

  • The size and impact of the changes that it introduces
  • The need for product review
  • Maintenance status of the parent repository

💡 As a result it may take up to several weeks or months to complete a review and merge your PR.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the Instructor API v2 special-exams allowance endpoints so that granting a new allowance overwrites any existing allowance for the same user+exam (rather than allowing multiple allowance types to accumulate), addressing item 1 in openedx/frontend-app-instructor-dashboard#194.

Changes:

  • Add a helper to “add or replace” an allowance by removing existing allowances with different keys for the same user+exam.
  • Update single-exam and bulk allowance POST endpoints to use the new replacement behavior and to surface user lookup failures.
  • Add tests asserting that granting/bulk-granting an allowance with a different key replaces the previous one.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
lms/djangoapps/instructor/views/api_v2.py Introduces allowance replacement helper and wires it into allowance grant/bulk-grant endpoints.
lms/djangoapps/instructor/tests/views/test_special_exams_api_v2.py Adds regression tests validating “replace different key” behavior for single and bulk grants.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread lms/djangoapps/instructor/views/api_v2.py Outdated
Comment thread lms/djangoapps/instructor/views/api_v2.py Outdated
Comment thread lms/djangoapps/instructor/views/api_v2.py Outdated
@brianjbuck-wgu brianjbuck-wgu force-pushed the bugfix/194-allowance-replace-on-duplicate branch from 3d65538 to 712104b Compare April 30, 2026 19:23
@brianjbuck-wgu brianjbuck-wgu marked this pull request as ready for review April 30, 2026 19:24
@wgu-taylor-payne
Copy link
Copy Markdown
Contributor

Can you provide more context in the PR description itself?

@brianjbuck-wgu
Copy link
Copy Markdown
Contributor Author

@wgu-taylor-payne, I updated the PR description. Hopefully that makes more sense and gives a bit more context.

Copy link
Copy Markdown
Contributor

@wgu-taylor-payne wgu-taylor-payne 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, thanks!

@wgu-taylor-payne wgu-taylor-payne merged commit 54363d2 into openedx:master May 1, 2026
42 checks passed
@github-project-automation github-project-automation Bot moved this from Needs Triage to Done in Contributions May 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

open-source-contribution PR author is not from Axim or 2U

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

4 participants