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: api function to delete learner's course grades #34410

Merged
merged 3 commits into from
Mar 26, 2024

Conversation

hajorg
Copy link
Contributor

@hajorg hajorg commented Mar 22, 2024

Description

This PR creates a function to delete learner's course grades as a part of reset. See https://2u-internal.atlassian.net/browse/AU-1912

Supporting information

openedx/platform-roadmap#331

@hajorg hajorg force-pushed the hajorg/au-1912-delete-learner-course-grade branch from 43f826b to 36f3895 Compare March 22, 2024 11:28
@hajorg hajorg marked this pull request as ready for review March 22, 2024 14:04
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.

Some suggestions

lms/djangoapps/grades/models.py Outdated Show resolved Hide resolved
lms/djangoapps/grades/models.py Outdated Show resolved Hide resolved
lms/djangoapps/grades/models.py Outdated Show resolved Hide resolved
course_id: The id of the course associated with the desired grade
user_id: The user associated with the desired grade
"""
try:
Copy link
Contributor

Choose a reason for hiding this comment

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

nice

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.

Functionally it's good, just a couple comments on the tests and error handling

@classmethod
def delete_subsection_grades_for_learner(cls, user_id, course_key):
"""
Clears Subsection grade override for a learner in a course
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
Clears Subsection grade override for a learner in a course
Clears Subsection grades and overrides for a learner in a course

lms/djangoapps/grades/models_api.py Outdated Show resolved Hide resolved
lms/djangoapps/grades/tests/test_models.py Show resolved Hide resolved
lms/djangoapps/grades/tests/test_models.py Outdated Show resolved Hide resolved
lms/djangoapps/grades/tests/test_api.py Outdated Show resolved Hide resolved
lms/djangoapps/grades/tests/test_api.py Outdated Show resolved Hide resolved
lms/djangoapps/grades/tests/test_api.py Outdated Show resolved Hide resolved
@@ -187,51 +187,56 @@ def test_clear_user_course_grades(self):
self.subsection.location
)

def test_clear_wrong_user_course_grades(self):
wrong_user = UserFactory()
def _create_and_get_user_grades(self, user_id):
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice refactor

@hajorg hajorg merged commit 53da867 into master Mar 26, 2024
67 checks passed
@hajorg hajorg deleted the hajorg/au-1912-delete-learner-course-grade branch March 26, 2024 14:08
@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
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants