Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: allow course staff role to be updated with email change #321

Merged
merged 1 commit into from
Sep 23, 2024

Conversation

alangsto
Copy link
Member

@alangsto alangsto commented Sep 20, 2024

JIRA: COSMO-478

Description:
If a user is added to a course with either staff or instructor permissions, changes their email, and then is added to another course as staff or instructor, the second event meant to sync staff role permissions with edx-exams will fail due to an integrity/unique constraint error. This is because the call to get or create a new User object in the event handler is keyed off of both the username and email fields, which means that subsequent email changes will result in calls to create a new User object with the same username but new email, as opposed to just getting the existing User object.

This bug is fixed by only using the username field to get or create a new User object.

Merge checklist:

  • All reviewers approved
  • CI build is green
  • Changelog record added
  • Documentation updated (not only docstrings)
  • Commits are squashed

Post merge:

  • Delete working branch (if not needed anymore)

Copy link

Coverage report

Click to see where and how coverage changed

FileStatementsMissingCoverageCoverage
(new stmts)
Lines missing
  edx_exams/apps/core/tests
  test_handlers.py
Project Total  

This report was generated by python-coverage-comment-action

@alangsto alangsto merged commit a14fb39 into main Sep 23, 2024
5 checks passed
@alangsto alangsto deleted the alangsto/fix_role_listener branch September 23, 2024 13:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants