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

Fix 'missing resource' alert not showing on Home page for missing quiz resources #12008

Conversation

LianaHarris360
Copy link
Member

@LianaHarris360 LianaHarris360 commented Mar 21, 2024

Summary

This pr fixes the 'missing resource' alert not displaying on the Homepage if quiz resources have been removed from the device.

  • Adds function _map_contentnodes() to map exam and lesson node ids using the same approach
  • Updates how missing resources for exams are checked within LearnerClassroomViewset

References

Fixes #11453

Reviewer guidance

  1. Set up a full facility and a learn-only device.
  2. Assign a quiz to the learner on the LOD.
  3. Sign in as the learner and delete some of the quiz resources by going to Device > Channel.
  4. Go to the learner's home page and confirm the alert 'Some resources are missing or not supported..' is shown.
missingresourcealert.mp4

Testing checklist

  • Contributor has fully tested the PR manually
  • If there are any front-end changes, before/after screenshots are included
  • Critical user journeys are covered by Gherkin stories
  • Critical and brittle code paths are covered by unit tests

PR process

  • PR has the correct target branch and milestone
  • PR has 'needs review' or 'work-in-progress' label
  • If PR is ready for review, a reviewer has been added. (Don't use 'Assignees')
  • If this is an important user-facing change, PR or related issue has a 'changelog' label
  • If this includes an internal dependency change, a link to the diff is provided

Reviewer checklist

  • Automated test coverage is satisfactory
  • PR is fully functional
  • PR has been tested for accessibility regressions
  • External dependency files were updated if necessary (yarn and pip)
  • Documentation is updated
  • Contributor is in AUTHORS.md

@LianaHarris360 LianaHarris360 added P1 - important Priority: High impact on UX APP: Learn Re: Learn App (content, quizzes, lessons, etc.) labels Mar 21, 2024
@github-actions github-actions bot added DEV: backend Python, databases, networking, filesystem... SIZE: small labels Mar 21, 2024
@LianaHarris360 LianaHarris360 marked this pull request as ready for review March 21, 2024 16:55
@LianaHarris360 LianaHarris360 added the TODO: needs review Waiting for review label Mar 21, 2024
@radinamatic radinamatic requested a review from pcenov March 22, 2024 02:28
Copy link
Member

@pcenov pcenov left a 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.

Copy link
Member

@rtibbles rtibbles left a 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!

)
missing_resource = False
for question_source in exam["question_sources"]:
missing_resource = not question_source["exercise_id"] in contentnode_map
Copy link
Member

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.

Copy link
Member Author

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!

kolibri/plugins/learn/viewsets.py Show resolved Hide resolved
@LianaHarris360 LianaHarris360 requested a review from rtibbles March 22, 2024 19:22
Copy link
Member

@rtibbles rtibbles left a 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!

@rtibbles rtibbles merged commit 85698d2 into learningequality:release-v0.16.x Mar 22, 2024
34 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
APP: Learn Re: Learn App (content, quizzes, lessons, etc.) DEV: backend Python, databases, networking, filesystem... P1 - important Priority: High impact on UX SIZE: small TODO: needs review Waiting for review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Quizzes - The 'missing resource' alert is not displayed at the Home page
3 participants