nelc / futurex-openedx-extensions

Open edX APIs and reporting tools
Other
0 stars 0 forks source link

bug: 500 error on learner courses #19

Closed OmarIthawi closed 3 months ago

OmarIthawi commented 4 months ago

Open https://stage.nelp.gov.sa/api/fx/learners/v1/learner_courses/omarithawi_elc/

It'll throw a 500 error.

Learner courses has a 500 error:
FieldError

/api/fx/learners/v1/learner_courses/{username}/

Ongoing
Level: Error
Unhandled
Cannot resolve keyword 'course_key' into field. Choices are: block_key, block_type, completion, context_key, created, id, modified, user, user_id

FieldError: Cannot resolve keyword 'course_key' into field. Choices are: block_key, block_type, completion, context_key, created, id, modified, user, user_id
  File "django/core/handlers/exception.py", line 47, in inner
    response = get_response(request)
  File "django/core/handlers/base.py", line 181, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "contextlib.py", line 75, in inner
    return func(*args, **kwds)
  File "newrelic/hooks/framework_django.py", line 552, in wrapper
    return wrapped(*args, **kwargs)
  File "django/views/decorators/csrf.py", line 54, in wrapped_view
    return view_func(*args, **kwargs)
  File "django/views/generic/base.py", line 70, in view
    return self.dispatch(request, *args, **kwargs)
  File "newrelic/hooks/component_djangorestframework.py", line 61, in _nr_wrapper_APIView_dispatch_
    return wrapped(*args, **kwargs)
  File "rest_framework/views.py", line 509, in dispatch
    response = self.handle_exception(exc)
  File "newrelic/hooks/component_djangorestframework.py", line 68, in _handle_exception_wrapper
    return wrapped(*args, **kwargs)
  File "rest_framework/views.py", line 469, in handle_exception
    self.raise_uncaught_exception(exc)
  File "rest_framework/views.py", line 480, in raise_uncaught_exception
    raise exc
  File "rest_framework/views.py", line 506, in dispatch
    response = handler(request, *args, **kwargs)
  File "futurex_openedx_extensions/dashboard/views.py", line 202, in get
    courses = get_learner_courses_info_queryset(tenant_ids, user_id)
  File "futurex_openedx_extensions/dashboard/details/courses.py", line 162, in get_learner_courses_info_queryset
    BlockCompletion.objects.filter(
  File "django/db/models/manager.py", line 85, in manager_method
    return getattr(self.get_queryset(), name)(*args, **kwargs)
  File "django/db/models/query.py", line 941, in filter
    return self._filter_or_exclude(False, args, kwargs)
  File "django/db/models/query.py", line 961, in _filter_or_exclude
    clone._filter_or_exclude_inplace(negate, args, kwargs)
  File "django/db/models/query.py", line 968, in _filter_or_exclude_inplace
    self._query.add_q(Q(*args, **kwargs))
  File "django/db/models/sql/query.py", line 1416, in add_q
    clause, _ = self._add_q(q_object, self.used_aliases)
  File "django/db/models/sql/query.py", line 1435, in _add_q
    child_clause, needed_inner = self.build_filter(
  File "django/db/models/sql/query.py", line 1309, in build_filter
    lookups, parts, reffed_expression = self.solve_lookup_type(arg)
  File "django/db/models/sql/query.py", line 1135, in solve_lookup_type
    _, field, _, lookup_parts = self.names_to_path(lookup_splitted, self.get_meta())
  File "django/db/models/sql/query.py", line 1562, in names_to_path
    raise FieldError("Cannot resolve keyword '%s' into field. "
shadinaif commented 3 months ago

Omar already solved it 👍🏼