-
Notifications
You must be signed in to change notification settings - Fork 699
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 'missing resource' alert not showing on Home page for missing quiz resources #12008
Fix 'missing resource' alert not showing on Home page for missing quiz resources #12008
Conversation
Build Artifacts
|
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 @LianaHarris360 - no issues observed while manually testing. This is working correctly now.
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.
I think there are a couple of things to clean up here, but makes sense overall!
kolibri/plugins/learn/viewsets.py
Outdated
) | ||
missing_resource = False | ||
for question_source in exam["question_sources"]: | ||
missing_resource = not question_source["exercise_id"] in contentnode_map |
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.
We can shortcut the evaluation here (so it's parallel to the previous any
) by breaking out of the loop in this case.
So could change this to:
for question_source in exam["question_sources"]:
if question_source["exercise_id"] not in contentnode_map:
missing_resource = True
break
Note also the slightly more idiomatic not in
syntax rather than negating an in
expression.
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.
Right, when the contentnode_map
doesn't contain the exercise_id
of one question, the missing_resource
will continue to be false. So no need to check every exam question!
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.
Looks good to me, and @pcenov says it works, so we have the green light!
Summary
This pr fixes the 'missing resource' alert not displaying on the Homepage if quiz resources have been removed from the device.
_map_contentnodes()
to map exam and lesson node ids using the same approachLearnerClassroomViewset
References
Fixes #11453
Reviewer guidance
missingresourcealert.mp4
Testing checklist
PR process
Reviewer checklist
yarn
andpip
)