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

Course.MultipleObjectsReturned: get() returned more than one Course -- it returned 2! #4982

Open
sentry-io bot opened this issue Jul 8, 2021 · 0 comments

Comments

@sentry-io
Copy link

sentry-io bot commented Jul 8, 2021

We started throwing this error suddenly on 7/8, probably due to data in production, and not due to a code change.

We often have to create course runs in the db before a course key is available. Queries on course runs shouldn't expect a unique course key.

We should add some tests that exercise this condition.

Sentry Issue: MICROMASTERS-582

Course.MultipleObjectsReturned: get() returned more than one Course -- it returned 2!
(5 additional frame(s) were not displayed)
...
  File "dashboard/api.py", line 274, in <listcomp>
    run_statuses = [get_status_for_courserun(course_run, mmtrack)
  File "dashboard/api.py", line 399, in get_status_for_courserun
    if mmtrack.has_paid(course_run.edx_course_key):
  File "dashboard/utils.py", line 222, in has_paid
    course = Course.objects.get(courserun__edx_course_key=edx_course_key)
  File "django/db/models/manager.py", line 82, in manager_method
    return getattr(self.get_queryset(), name)(*args, **kwargs)
  File "django/db/models/query.py", line 410, in get
    raise self.model.MultipleObjectsReturned(

An exception was intercepted by custom_exception_handler
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

No branches or pull requests

0 participants