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

feat: add celery task to reset course progress for learner #34350

Merged
merged 4 commits into from
Mar 21, 2024

Conversation

hajorg
Copy link
Contributor

@hajorg hajorg commented Mar 11, 2024

Description

This PR uses celery task to reset learner's course progress

Supporting information

Roadmap issue: openedx/platform-roadmap#331

Celery task to reset individual learner

@hajorg hajorg force-pushed the hajorg/au-1848-course-reset-celery-task branch 2 times, most recently from c35db91 to 11f2af9 Compare March 12, 2024 14:10
@hajorg hajorg force-pushed the hajorg/au-1848-course-reset-celery-task branch from 11f2af9 to 9b6a117 Compare March 12, 2024 14:33
@hajorg hajorg marked this pull request as ready for review March 12, 2024 14:38
Copy link
Contributor

@arbrandes arbrandes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @hajorg! Do you mind adding some context as to why this is being done? The link you posted is to a private page that people outside 2U cannot access.

@hajorg
Copy link
Contributor Author

hajorg commented Mar 13, 2024

Hi @hajorg! Do you mind adding some context as to why this is being done? The link you posted is to a private page that people outside 2U cannot access.

Hi @arbrandes, the goal is to allow the ability to reset a learner's progress in a course so that they may re-attempt a course within the same run, without waiting for the next run.

@arbrandes
Copy link
Contributor

arbrandes commented Mar 13, 2024

Thank you! But if this is not a pre-existing feature, I believe it should be going through the Product Review process. I can't make a ruling on whether it should or not, though: but when in doubt, we should ask the Product Working Group.

Copy link
Contributor

@jansenk jansenk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good but I have a couple suggestions, and I caught a subtle issue with how you're looking up blocks.

Also, a general comment about the tests: What you have is good, but I think you should also add some checks / tests for the downstream effects of the task. At the very minimum you should mock or wrap reset_student_attempts and

  1. for the success test, assert that it was called for all "leaf" blocks in your course
  2. for the Not Found test, assert that it was stilled called for each block despite the fact that there were errors
  3. for the error case, assert that it was not called for any blocks
  4. I'd add another test where an Exception is raised by a call to reset_student_attempts, and you can assert that no blocks after the error was raised were attempted to be reset

lms/djangoapps/support/tasks.py Outdated Show resolved Hide resolved
lms/djangoapps/support/tasks.py Outdated Show resolved Hide resolved
lms/djangoapps/support/tasks.py Outdated Show resolved Hide resolved
lms/djangoapps/support/tasks.py Outdated Show resolved Hide resolved
lms/djangoapps/support/tests/test_tasks.py Outdated Show resolved Hide resolved
lms/djangoapps/support/tests/test_tasks.py Outdated Show resolved Hide resolved
lms/djangoapps/support/tests/test_tasks.py Outdated Show resolved Hide resolved
lms/djangoapps/support/tests/test_tasks.py Outdated Show resolved Hide resolved
lms/djangoapps/support/tests/test_tasks.py Outdated Show resolved Hide resolved
Copy link
Contributor

@jansenk jansenk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are some questions around the product side of this that need to be worked out so hold off on merging, but code-wise I'm approving this

@jansenk
Copy link
Contributor

jansenk commented Mar 14, 2024

One last comment - just for completeness, I'd love if you would change one of the problem blocks to be a block that has a different "category", even if one was a "video" rather than a problem, just so the tests demonstrate that we are resetting all leaf nodes

@arbrandes arbrandes added the product review PR requires product review before merging label Mar 15, 2024
@hajorg hajorg merged commit 9c3833c into master Mar 21, 2024
67 checks passed
@hajorg hajorg deleted the hajorg/au-1848-course-reset-celery-task branch March 21, 2024 15:21
@edx-pipeline-bot
Copy link
Contributor

2U Release Notice: This PR has been deployed to the edX staging environment in preparation for a release to production.

@edx-pipeline-bot
Copy link
Contributor

2U Release Notice: This PR has been deployed to the edX production environment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
product review PR requires product review before merging
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants