-
Notifications
You must be signed in to change notification settings - Fork 75
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 non-revealed chapters in ModuleView #1273
Fix non-revealed chapters in ModuleView #1273
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
@@ -67,11 +68,12 @@ def get_resource_objects(self): | |||
self.url_without_language = remove_query_param_from_url(self.request.get_full_path(), 'hl') | |||
self.query_language = None | |||
self.user_language = None | |||
self.points = CachedPoints(self.instance, self.request.user, self.content, self.is_course_staff) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@PasiSa this crashes in the interactions between A+ and Gitmanager.
self.request.user
is a GraderUser
, but CachedPoints
does not work with GraderUser
.
aplus-plus-1 | [2023-09-21 00:45:45,023: ERROR/log] Internal Server Error: /api/v2/courses/2/send_mail/
aplus-plus-1 | Traceback (most recent call last):
aplus-plus-1 | File "/usr/local/lib/python3.9/dist-packages/rest_framework/views.py", line 497, in dispatch
aplus-plus-1 | self.initial(request, *args, **kwargs)
aplus-plus-1 | File "/srv/aplus/authorization/api/mixins.py", line 14, in initial
aplus-plus-1 | self.get_resource_objects()
aplus-plus-1 | File "/srv/aplus/course/viewbase.py", line 71, in get_resource_objects
aplus-plus-1 | self.points = CachedPoints(self.instance, self.request.user, self.content, self.is_course_staff)
aplus-plus-1 | File "/srv/aplus/exercise/cache/points.py", line 69, in __init__
aplus-plus-1 | super().__init__(course_instance, user)
aplus-plus-1 | File "/srv/aplus/lib/cache/cached.py", line 33, in __init__
aplus-plus-1 | self.data = self.__get_data()
aplus-plus-1 | File "/srv/aplus/lib/cache/cached.py", line 61, in __get_data
aplus-plus-1 | data = self._generate_data(*self.__models, data=data)
aplus-plus-1 | File "/srv/aplus/exercise/cache/points.py", line 91, in _generate_data
aplus-plus-1 | user.userprofile.submissions
aplus-plus-1 | AttributeError: 'GraderUser' object has no attribute 'submissions'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My workaround: a8e76f7
Commit 0e74906 (#1273) introduced a crash when `GraderUser` accesses any course page or API. The commit added a `CachedPoints` instance variable to `CourseInstanceBaseMixin`, but `CachedPoints` crashes when it is initialized with the `GraderUser`. `CachedPoints` does not crash with `AnonymousUser`, thus it is used instead of `GraderUser` to work around the crash. In the master branch, the commit 0c0de05 is similar to 0e74906, but there is no crash due to the cache changes in #1231.
Commit 0e74906 (apluslms#1273) introduced a crash when `GraderUser` accesses any course page or API. The commit added a `CachedPoints` instance variable to `CourseInstanceBaseMixin`, but `CachedPoints` crashes when it is initialized with the `GraderUser`. `CachedPoints` does not crash with `AnonymousUser`, thus it is used instead of `GraderUser` to work around the crash. In the master branch, the commit 0c0de05 is similar to 0e74906, but there is no crash due to the cache changes in apluslms#1231.
Fixes #1266
Slightly modified from similar commit earlier pushed to master (#1267 )
Description
What?
[ANSWER HERE]
Why?
[ANSWER HERE]
How?
[ANSWER HERE]
Fixes #
Testing
Remember to add or update unit tests for new features and changes.
What type of test did you run?
[ADD A DESCRIPTION ABOUT WHAT YOU TESTED MANUALLY]
Did you test the changes in
Think of what is affected by these changes and could become broken
Translation
Programming style
Have you updated the README or other relevant documentation?
Is it Done?
Clean up your git commit history before submitting the pull request!