Anonymous Course Access in Nutmeg

Hi,

We had anonymous site access working, but right now all we are seeing is “There was an error loading this course.”

Looking at the LMS logs an exception seems to be happening for the course grades? Any idea on what might be causing this or how to fix it?

Thanks!

lms_1                        | 2022-08-11 21:57:32,365 ERROR 7 [root] [user None] [ip None] signals.py:22 - Uncaught exception from None
lms_1                        | Traceback (most recent call last):
lms_1                        |   File "/openedx/edx-platform/./lms/djangoapps/grades/models.py", line 620, in read
lms_1                        |     prefetched_grades = get_cache(cls._CACHE_NAMESPACE)[cls._cache_key(course_id)]
lms_1                        | KeyError: 'grades_cache.course-v1:NLA+IL1010+20_21'
lms_1                        |
lms_1                        | During handling of the above exception, another exception occurred:
lms_1                        |
lms_1                        | Traceback (most recent call last):
lms_1                        |   File "/openedx/edx-platform/./lms/djangoapps/grades/course_grade_factory.py", line 50, in read
lms_1                        |     return self._read(user, course_data)
lms_1                        |   File "/openedx/edx-platform/./lms/djangoapps/grades/course_grade_factory.py", line 152, in _read
lms_1                        |     persistent_grade = PersistentCourseGrade.read(user.id, course_data.course_key)
lms_1                        |   File "/openedx/edx-platform/./lms/djangoapps/grades/models.py", line 629, in read
lms_1                        |     return cls.objects.get(user_id=user_id, course_id=course_id)
lms_1                        |   File "/openedx/venv/lib/python3.8/site-packages/django/db/models/manager.py", line 85, in manager_method
lms_1                        |     return getattr(self.get_queryset(), name)(*args, **kwargs)
lms_1                        |   File "/openedx/venv/lib/python3.8/site-packages/django/db/models/query.py", line 435, in get
lms_1                        |     raise self.model.DoesNotExist(
lms_1                        | lms.djangoapps.grades.models.PersistentCourseGrade.DoesNotExist: PersistentCourseGrade matching query does not exist.
lms_1                        |
lms_1                        | During handling of the above exception, another exception occurred:
lms_1                        |
lms_1                        | Traceback (most recent call last):
lms_1                        |   File "/openedx/venv/lib/python3.8/site-packages/django/db/models/fields/__init__.py", line 1823, in get_prep_value
lms_1                        |     return int(value)
lms_1                        |   File "/openedx/venv/lib/python3.8/site-packages/django/contrib/auth/models.py", line 420, in __int__
lms_1                        |     raise TypeError('Cannot cast AnonymousUser to int. Are you trying to use it in place of User?')
lms_1                        | TypeError: Cannot cast AnonymousUser to int. Are you trying to use it in place of User?
lms_1                        |
lms_1                        | The above exception was the direct cause of the following exception:
lms_1                        |
lms_1                        | Traceback (most recent call last):
lms_1                        |   File "/openedx/venv/lib/python3.8/site-packages/django/core/handlers/exception.py", line 47, in inner
lms_1                        |     response = get_response(request)
lms_1                        |   File "/openedx/venv/lib/python3.8/site-packages/django/core/handlers/base.py", line 181, in _get_response
lms_1                        |     response = wrapped_callback(request, *callback_args, **callback_kwargs)
lms_1                        |   File "/opt/pyenv/versions/3.8.12/lib/python3.8/contextlib.py", line 75, in inner
lms_1                        |     return func(*args, **kwds)
lms_1                        |   File "/openedx/venv/lib/python3.8/site-packages/django/views/decorators/csrf.py", line 54, in wrapped_view
lms_1                        |     return view_func(*args, **kwargs)
lms_1                        |   File "/openedx/venv/lib/python3.8/site-packages/django/views/generic/base.py", line 70, in view
lms_1                        |     return self.dispatch(request, *args, **kwargs)
lms_1                        |   File "/openedx/venv/lib/python3.8/site-packages/rest_framework/views.py", line 509, in dispatch
lms_1                        |     response = self.handle_exception(exc)
lms_1                        |   File "/openedx/venv/lib/python3.8/site-packages/rest_framework/views.py", line 469, in handle_exception
lms_1                        |     self.raise_uncaught_exception(exc)
lms_1                        |   File "/openedx/venv/lib/python3.8/site-packages/rest_framework/views.py", line 480, in raise_uncaught_exception
lms_1                        |     raise exc
lms_1                        |   File "/openedx/venv/lib/python3.8/site-packages/rest_framework/views.py", line 506, in dispatch
lms_1                        |     response = handler(request, *args, **kwargs)
lms_1                        |   File "/openedx/venv/lib/python3.8/site-packages/rest_framework/generics.py", line 208, in get
lms_1                        |     return self.retrieve(request, *args, **kwargs)
lms_1                        |   File "/openedx/venv/lib/python3.8/site-packages/rest_framework/mixins.py", line 56, in retrieve
lms_1                        |     return Response(serializer.data)
lms_1                        |   File "/openedx/venv/lib/python3.8/site-packages/rest_framework/serializers.py", line 548, in data
lms_1                        |     ret = super().data
lms_1                        |   File "/openedx/venv/lib/python3.8/site-packages/rest_framework/serializers.py", line 246, in data
lms_1                        |     self._data = self.to_representation(self.instance)
lms_1                        |   File "/openedx/venv/lib/python3.8/site-packages/rest_framework/serializers.py", line 502, in to_representation
lms_1                        |     attribute = field.get_attribute(instance)
lms_1                        |   File "/openedx/venv/lib/python3.8/site-packages/rest_framework/fields.py", line 457, in get_attribute
lms_1                        |     return get_attribute(instance, self.source_attrs)
lms_1                        |   File "/openedx/venv/lib/python3.8/site-packages/rest_framework/fields.py", line 97, in get_attribute
lms_1                        |     instance = getattr(instance, attr)
lms_1                        |   File "/openedx/edx-platform/./openedx/core/djangoapps/courseware_api/views.py", line 221, in entrance_exam_data
lms_1                        |     self.course_grade, get_entrance_exam_usage_key(self.overview),
lms_1                        |   File "/openedx/venv/lib/python3.8/site-packages/django/utils/functional.py", line 48, in __get__
lms_1                        |     res = instance.__dict__[self.name] = self.func(instance)
lms_1                        |   File "/openedx/edx-platform/./openedx/core/djangoapps/courseware_api/views.py", line 187, in course_grade
lms_1                        |     return CourseGradeFactory().read(self.effective_user, self.course)
lms_1                        |   File "/openedx/edx-platform/./lms/djangoapps/grades/course_grade_factory.py", line 55, in read
lms_1                        |     return self._update(user, course_data, send_course_grade_signals=send_course_grade_signals)
lms_1                        |   File "/openedx/edx-platform/./lms/djangoapps/grades/course_grade_factory.py", line 215, in _update
lms_1                        |     COURSE_GRADE_NOW_FAILED.send(
lms_1                        |   File "/openedx/venv/lib/python3.8/site-packages/django/dispatch/dispatcher.py", line 180, in send
lms_1                        |     return [
lms_1                        |   File "/openedx/venv/lib/python3.8/site-packages/django/dispatch/dispatcher.py", line 181, in <listcomp>
lms_1                        |     (receiver, receiver(signal=self, sender=sender, **named))
lms_1                        |   File "/openedx/edx-platform/./lms/djangoapps/certificates/signals.py", line 92, in _listen_for_failing_grade
lms_1                        |     if is_on_certificate_allowlist(user, course_id):
lms_1                        |   File "/openedx/edx-platform/./lms/djangoapps/certificates/generation_handler.py", line 321, in is_on_certificate_allowlist
lms_1                        |     return CertificateAllowlist.objects.filter(user=user, course_id=course_key, allowlist=True).exists()
lms_1                        |   File "/openedx/venv/lib/python3.8/site-packages/django/db/models/manager.py", line 85, in manager_method
lms_1                        |     return getattr(self.get_queryset(), name)(*args, **kwargs)
lms_1                        |   File "/openedx/venv/lib/python3.8/site-packages/django/db/models/query.py", line 941, in filter
lms_1                        |     return self._filter_or_exclude(False, args, kwargs)
lms_1                        |   File "/openedx/edx-platform/./openedx/core/djangoapps/xmodule_django/models.py", line 47, in _filter_or_exclude
lms_1                        |     return super()._filter_or_exclude(*args, **kwargs)
lms_1                        |   File "/openedx/venv/lib/python3.8/site-packages/django/db/models/query.py", line 961, in _filter_or_exclude
lms_1                        |     clone._filter_or_exclude_inplace(negate, args, kwargs)
lms_1                        |   File "/openedx/venv/lib/python3.8/site-packages/django/db/models/query.py", line 968, in _filter_or_exclude_inplace
lms_1                        |     self._query.add_q(Q(*args, **kwargs))
lms_1                        |   File "/openedx/venv/lib/python3.8/site-packages/django/db/models/sql/query.py", line 1416, in add_q
lms_1                        |     clause, _ = self._add_q(q_object, self.used_aliases)
lms_1                        |   File "/openedx/venv/lib/python3.8/site-packages/django/db/models/sql/query.py", line 1435, in _add_q
lms_1                        |     child_clause, needed_inner = self.build_filter(
lms_1                        |   File "/openedx/venv/lib/python3.8/site-packages/django/db/models/sql/query.py", line 1370, in build_filter
lms_1                        |     condition = self.build_lookup(lookups, col, value)
lms_1                        |   File "/openedx/venv/lib/python3.8/site-packages/django/db/models/sql/query.py", line 1216, in build_lookup
lms_1                        |     lookup = lookup_class(lhs, rhs)
lms_1                        |   File "/openedx/venv/lib/python3.8/site-packages/django/db/models/lookups.py", line 25, in __init__
lms_1                        |     self.rhs = self.get_prep_lookup()
lms_1                        |   File "/openedx/venv/lib/python3.8/site-packages/django/db/models/fields/related_lookups.py", line 117, in get_prep_lookup
lms_1                        |     self.rhs = target_field.get_prep_value(self.rhs)
lms_1                        |   File "/openedx/venv/lib/python3.8/site-packages/django/db/models/fields/__init__.py", line 1825, in get_prep_value
lms_1                        |     raise e.__class__(
lms_1                        | TypeError: Field 'id' expected a number but got <django.contrib.auth.models.AnonymousUser object at 0x7f00def74f40>.
lms_1                        | [pid: 19|app: 0|req: 2869/6999] 172.18.0.5 () {56 vars in 1339 bytes} [Thu Aug 11 21:57:32 2022] GET /api/courseware/sequence/block-v1:NLA+IL1010+20_21+type@sequential+block@aabc642aab3f44ffb7d96af6e3512e81 => generated 4283 bytes in 448 msecs (HTTP/1.1 200) 8 headers in 306 bytes (1 switches on core 0)
lms_1                        | 2022-08-11 21:57:32,486 ERROR 7 [django.request] [user None] [ip 129.130.19.148] log.py:224 - Internal Server Error: /api/courseware/course/course-v1:NLA+IL1010+20_21
lms_1                        | Traceback (most recent call last):
lms_1                        |   File "/openedx/edx-platform/./lms/djangoapps/grades/models.py", line 620, in read
lms_1                        |     prefetched_grades = get_cache(cls._CACHE_NAMESPACE)[cls._cache_key(course_id)]
lms_1                        | KeyError: 'grades_cache.course-v1:NLA+IL1010+20_21'
lms_1                        |
lms_1                        | During handling of the above exception, another exception occurred:
lms_1                        |
lms_1                        | Traceback (most recent call last):
lms_1                        |   File "/openedx/edx-platform/./lms/djangoapps/grades/course_grade_factory.py", line 50, in read
lms_1                        |     return self._read(user, course_data)
lms_1                        |   File "/openedx/edx-platform/./lms/djangoapps/grades/course_grade_factory.py", line 152, in _read
lms_1                        |     persistent_grade = PersistentCourseGrade.read(user.id, course_data.course_key)
lms_1                        |   File "/openedx/edx-platform/./lms/djangoapps/grades/models.py", line 629, in read
lms_1                        |     return cls.objects.get(user_id=user_id, course_id=course_id)
lms_1                        |   File "/openedx/venv/lib/python3.8/site-packages/django/db/models/manager.py", line 85, in manager_method
lms_1                        |     return getattr(self.get_queryset(), name)(*args, **kwargs)
lms_1                        |   File "/openedx/venv/lib/python3.8/site-packages/django/db/models/query.py", line 435, in get
lms_1                        |     raise self.model.DoesNotExist(
lms_1                        | lms.djangoapps.grades.models.PersistentCourseGrade.DoesNotExist: PersistentCourseGrade matching query does not exist.
lms_1                        |
lms_1                        | During handling of the above exception, another exception occurred:
lms_1                        |
lms_1                        | Traceback (most recent call last):
lms_1                        |   File "/openedx/venv/lib/python3.8/site-packages/django/db/models/fields/__init__.py", line 1823, in get_prep_value
lms_1                        |     return int(value)
lms_1                        |   File "/openedx/venv/lib/python3.8/site-packages/django/contrib/auth/models.py", line 420, in __int__
lms_1                        |     raise TypeError('Cannot cast AnonymousUser to int. Are you trying to use it in place of User?')
lms_1                        | TypeError: Cannot cast AnonymousUser to int. Are you trying to use it in place of User?
lms_1                        |
lms_1                        | The above exception was the direct cause of the following exception:
lms_1                        |
lms_1                        | Traceback (most recent call last):
lms_1                        |   File "/openedx/venv/lib/python3.8/site-packages/django/core/handlers/exception.py", line 47, in inner
lms_1                        |     response = get_response(request)
lms_1                        |   File "/openedx/venv/lib/python3.8/site-packages/django/core/handlers/base.py", line 181, in _get_response
lms_1                        |     response = wrapped_callback(request, *callback_args, **callback_kwargs)
lms_1                        |   File "/opt/pyenv/versions/3.8.12/lib/python3.8/contextlib.py", line 75, in inner
lms_1                        |     return func(*args, **kwds)
lms_1                        |   File "/openedx/venv/lib/python3.8/site-packages/django/views/decorators/csrf.py", line 54, in wrapped_view
lms_1                        |     return view_func(*args, **kwargs)
lms_1                        |   File "/openedx/venv/lib/python3.8/site-packages/django/views/generic/base.py", line 70, in view
lms_1                        |     return self.dispatch(request, *args, **kwargs)
lms_1                        |   File "/openedx/venv/lib/python3.8/site-packages/rest_framework/views.py", line 509, in dispatch
lms_1                        |     response = self.handle_exception(exc)
lms_1                        |   File "/openedx/venv/lib/python3.8/site-packages/rest_framework/views.py", line 469, in handle_exception
lms_1                        |     self.raise_uncaught_exception(exc)
lms_1                        |   File "/openedx/venv/lib/python3.8/site-packages/rest_framework/views.py", line 480, in raise_uncaught_exception
lms_1                        |     raise exc
lms_1                        |   File "/openedx/venv/lib/python3.8/site-packages/rest_framework/views.py", line 506, in dispatch
lms_1                        |     response = handler(request, *args, **kwargs)
lms_1                        |   File "/openedx/venv/lib/python3.8/site-packages/rest_framework/generics.py", line 208, in get
lms_1                        |     return self.retrieve(request, *args, **kwargs)
lms_1                        |   File "/openedx/venv/lib/python3.8/site-packages/rest_framework/mixins.py", line 56, in retrieve
lms_1                        |     return Response(serializer.data)
lms_1                        |   File "/openedx/venv/lib/python3.8/site-packages/rest_framework/serializers.py", line 548, in data
lms_1                        |     ret = super().data
lms_1                        |   File "/openedx/venv/lib/python3.8/site-packages/rest_framework/serializers.py", line 246, in data
lms_1                        |     self._data = self.to_representation(self.instance)
lms_1                        |   File "/openedx/venv/lib/python3.8/site-packages/rest_framework/serializers.py", line 502, in to_representation
lms_1                        |     attribute = field.get_attribute(instance)
lms_1                        |   File "/openedx/venv/lib/python3.8/site-packages/rest_framework/fields.py", line 457, in get_attribute
lms_1                        |     return get_attribute(instance, self.source_attrs)
lms_1                        |   File "/openedx/venv/lib/python3.8/site-packages/rest_framework/fields.py", line 97, in get_attribute
lms_1                        |     instance = getattr(instance, attr)
lms_1                        |   File "/openedx/edx-platform/./openedx/core/djangoapps/courseware_api/views.py", line 221, in entrance_exam_data
lms_1                        |     self.course_grade, get_entrance_exam_usage_key(self.overview),
lms_1                        |   File "/openedx/venv/lib/python3.8/site-packages/django/utils/functional.py", line 48, in __get__
lms_1                        |     res = instance.__dict__[self.name] = self.func(instance)
lms_1                        |   File "/openedx/edx-platform/./openedx/core/djangoapps/courseware_api/views.py", line 187, in course_grade
lms_1                        |     return CourseGradeFactory().read(self.effective_user, self.course)
lms_1                        |   File "/openedx/edx-platform/./lms/djangoapps/grades/course_grade_factory.py", line 55, in read
lms_1                        |     return self._update(user, course_data, send_course_grade_signals=send_course_grade_signals)
lms_1                        |   File "/openedx/edx-platform/./lms/djangoapps/grades/course_grade_factory.py", line 215, in _update
lms_1                        |     COURSE_GRADE_NOW_FAILED.send(
lms_1                        |   File "/openedx/venv/lib/python3.8/site-packages/django/dispatch/dispatcher.py", line 180, in send
lms_1                        |     return [
lms_1                        |   File "/openedx/venv/lib/python3.8/site-packages/django/dispatch/dispatcher.py", line 181, in <listcomp>
lms_1                        |     (receiver, receiver(signal=self, sender=sender, **named))
lms_1                        |   File "/openedx/edx-platform/./lms/djangoapps/certificates/signals.py", line 92, in _listen_for_failing_grade
lms_1                        |     if is_on_certificate_allowlist(user, course_id):
lms_1                        |   File "/openedx/edx-platform/./lms/djangoapps/certificates/generation_handler.py", line 321, in is_on_certificate_allowlist
lms_1                        |     return CertificateAllowlist.objects.filter(user=user, course_id=course_key, allowlist=True).exists()
lms_1                        |   File "/openedx/venv/lib/python3.8/site-packages/django/db/models/manager.py", line 85, in manager_method
lms_1                        |     return getattr(self.get_queryset(), name)(*args, **kwargs)
lms_1                        |   File "/openedx/venv/lib/python3.8/site-packages/django/db/models/query.py", line 941, in filter
lms_1                        |     return self._filter_or_exclude(False, args, kwargs)
lms_1                        |   File "/openedx/edx-platform/./openedx/core/djangoapps/xmodule_django/models.py", line 47, in _filter_or_exclude
lms_1                        |     return super()._filter_or_exclude(*args, **kwargs)
lms_1                        |   File "/openedx/venv/lib/python3.8/site-packages/django/db/models/query.py", line 961, in _filter_or_exclude
lms_1                        |     clone._filter_or_exclude_inplace(negate, args, kwargs)
lms_1                        |   File "/openedx/venv/lib/python3.8/site-packages/django/db/models/query.py", line 968, in _filter_or_exclude_inplace
lms_1                        |     self._query.add_q(Q(*args, **kwargs))
lms_1                        |   File "/openedx/venv/lib/python3.8/site-packages/django/db/models/sql/query.py", line 1416, in add_q
lms_1                        |     clause, _ = self._add_q(q_object, self.used_aliases)
lms_1                        |   File "/openedx/venv/lib/python3.8/site-packages/django/db/models/sql/query.py", line 1435, in _add_q
lms_1                        |     child_clause, needed_inner = self.build_filter(
lms_1                        |   File "/openedx/venv/lib/python3.8/site-packages/django/db/models/sql/query.py", line 1370, in build_filter
lms_1                        |     condition = self.build_lookup(lookups, col, value)
lms_1                        |   File "/openedx/venv/lib/python3.8/site-packages/django/db/models/sql/query.py", line 1216, in build_lookup
lms_1                        |     lookup = lookup_class(lhs, rhs)
lms_1                        |   File "/openedx/venv/lib/python3.8/site-packages/django/db/models/lookups.py", line 25, in __init__
lms_1                        |     self.rhs = self.get_prep_lookup()
lms_1                        |   File "/openedx/venv/lib/python3.8/site-packages/django/db/models/fields/related_lookups.py", line 117, in get_prep_lookup
lms_1                        |     self.rhs = target_field.get_prep_value(self.rhs)
lms_1                        |   File "/openedx/venv/lib/python3.8/site-packages/django/db/models/fields/__init__.py", line 1825, in get_prep_value
lms_1                        |     raise e.__class__(
lms_1                        | TypeError: Field 'id' expected a number but got <django.contrib.auth.models.AnonymousUser object at 0x7f00def74f40>.
1 Like

Adding a more complete log in case something pops out. (Was to long to just put in the body)

Thanks!

We’ve been seeing this error a lot in our nutmeg logs, but we don’t even have anonymous access turned on.

As far as I’ve heard, it hasn’t caused any end-user visible errors.

Our courses that are usually allowed for anonymous access right now, I get the following error.

Example: Course | New Literacies Alliance and expand Lesson → Follow My Research (Course | New Literacies Alliance) which brings to the error message above.

1 Like

I report, I got the exact same error and I don’t know how to resolve yet…
My understanding the error is because:

It seems the grade service is trying to get the grade of an anonymous user and it then throw an exception bceause the id is not int

Now given that, should the grade fail silently or should the grade service not be called when the user is anonymous (i.e. grade shuold ignore signal when user is none)? may be there is third option…

1 Like

So as near as I can tell, the courseware API (which sends a bunch of metadata about the course, like the name) is trying to find the student’s overall grade in the course as part of the entrance exam information (because it calculates the ratio of the total grade to the grade of the entrance exam). That’s failing for an Anonymous user because the user has no User id and no way to generate grades. That kicks off a bunch of grading related machinery that helps to obscure the error message.

I think the right thing to do would be to either remove that data from the courseware API view when the user is Anonymous, or make the serializer default it to some output when the user is Anonymous. I’m not sure what the frontend dependencies are on this, so the latter is probably safer to do so.

I think the offending code was added here:

1 Like

@ghassan recommend something like the following on slack

Check if the user is anonymous and then set those values:

       return {
           'entrance_exam_current_score': 0,
           'entrance_exam_enabled': course_has_entrance_exam(self.overview),
           'entrance_exam_id': self.overview.entrance_exam_id,
           'entrance_exam_minimum_score_pct': self.overview.entrance_exam_minimum_score_pct,
           'entrance_exam_passed': False,
       }

based on https://github.com/openedx/edx-platform/blob/1d618055dc5a44b94a1da63ef4017a2015aad018/openedx/core/djangoapps/courseware_api/views.py#L219-L227

However, I am not sure how I would overwrite this file with Tutor through a plugin? @regis do you have any thoughts on how to accomplish this?

I am assuming I would probably want something like this as the final code @ghassan?

    def entrance_exam_data(self):
        """
        Returns Entrance Exam data for the course
        Although some of the fields will have values (i.e. entrance_exam_minimum_score_pct and
        entrance_exam_passed), nothing will be used unless entrance_exam_enabled is True.
        """
        if self.effective_user.is_anonymous:
            return {
                'entrance_exam_current_score': 0,
                ),
                'entrance_exam_enabled': course_has_entrance_exam(self.overview),
                'entrance_exam_id': self.overview.entrance_exam_id,
                'entrance_exam_minimum_score_pct': self.overview.entrance_exam_minimum_score_pct,
                'entrance_exam_passed': False,
            }
        else: 
            return {
                'entrance_exam_current_score': get_entrance_exam_score(
                    self.course_grade, get_entrance_exam_usage_key(self.overview),
                ),
                'entrance_exam_enabled': course_has_entrance_exam(self.overview),
                'entrance_exam_id': self.overview.entrance_exam_id,
                'entrance_exam_minimum_score_pct': self.overview.entrance_exam_minimum_score_pct,
                'entrance_exam_passed': user_has_passed_entrance_exam(self.effective_user, self.overview),
            }
1 Like

I created a ticket to track this work:

FWIW, if there are folks who feel comfortable doing this work, please comment on the ticket. Otherwise, I plan to fix this next week and backport it to Nutmeg.

1 Like

Thank you @dave!

I just wanted to report back the solution I had mentioned above, did not work. :frowning:

@schenedx pointed out that you can skip this code path by enabling the grades.assume_zero_grade_if_absent waffle flag, which could be a viable short term fix for you folks until we get this fixed in Nutmeg.

1 Like

Thanks @dave and @schendex! It looks like that might work for us in the short term. Currently doing some testing to make sure it doesn’t have any side affects with our LTI integrations.

Yes that exactly what I meant. I have not set a if clause for me because I consdier all user anonymous for my demo instance. here is the exact code diff for me

       """
         Although some of the fields will have values (i.e. entrance_exam_minimum_score_pct and
         entrance_exam_passed), nothing will be used unless entrance_exam_enabled is True.
         """
+        print("self user",self.effective_user.is_anonymous)
         return {
-            'entrance_exam_current_score': get_entrance_exam_score(
-                self.course_grade, get_entrance_exam_usage_key(self.overview),
-            ),
+            'entrance_exam_current_score': 0,
             'entrance_exam_enabled': course_has_entrance_exam(self.overview),
             'entrance_exam_id': self.overview.entrance_exam_id,
             'entrance_exam_minimum_score_pct': self.overview.entrance_exam_minimum_score_pct,
-            'entrance_exam_passed': user_has_passed_entrance_exam(self.effective_user, self.overview),
+            'entrance_exam_passed': False,
         }

self user was true on chrome incgonito and true when I was logged in. So in theory it should work just intrested why it didn’t but any way @dave flag is definitely better approach if it work as expeceted.

I confirm this worked for me as well

My apologies, folks. The timing of this got thrown off by me being out sick with covid for a spell, and falling behind in other work because of it. I’m now looking to do this patch next week.

2 Likes

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.