From b419cacb3506ea9c1fd80a49746e69324aa95369 Mon Sep 17 00:00:00 2001 From: Muhammad Anas Date: Wed, 28 Aug 2024 11:41:27 +0000 Subject: [PATCH] fix: renamed DatabaseNotReadyError --- lms/djangoapps/grades/exceptions.py | 6 +++--- lms/djangoapps/grades/tasks.py | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lms/djangoapps/grades/exceptions.py b/lms/djangoapps/grades/exceptions.py index d615f1f64d5c..db2793efaa15 100644 --- a/lms/djangoapps/grades/exceptions.py +++ b/lms/djangoapps/grades/exceptions.py @@ -3,9 +3,9 @@ """ -class DatabaseNotReadyError(IOError): +class ScoreNotFoundError(IOError): """ - Subclass of IOError to indicate the database has not yet committed - the data we're trying to find. + Subclass of IOError to indicate the staff has not yet graded the problem or + the database has not yet committed the data we're trying to find. """ pass # lint-amnesty, pylint: disable=unnecessary-pass diff --git a/lms/djangoapps/grades/tasks.py b/lms/djangoapps/grades/tasks.py index 3b504e61ebe8..9ec237274b4f 100644 --- a/lms/djangoapps/grades/tasks.py +++ b/lms/djangoapps/grades/tasks.py @@ -33,7 +33,7 @@ from .config.waffle import DISABLE_REGRADE_ON_POLICY_CHANGE from .constants import ScoreDatabaseTableEnum from .course_grade_factory import CourseGradeFactory -from .exceptions import DatabaseNotReadyError +from .exceptions import ScoreNotFoundError from .grade_utils import are_grades_frozen from .signals.signals import SUBSECTION_SCORE_CHANGED from .subsection_grade_factory import SubsectionGradeFactory @@ -45,7 +45,7 @@ KNOWN_RETRY_ERRORS = ( # Errors we expect occasionally, should be resolved on retry DatabaseError, ValidationError, - DatabaseNotReadyError, + ScoreNotFoundError, UsageKeyNotInBlockStructure, ) RECALCULATE_GRADE_DELAY_SECONDS = 2 # to prevent excessive _has_db_updated failures. See TNL-6424. @@ -239,7 +239,7 @@ def _recalculate_subsection_grade(self, **kwargs): has_database_updated = _has_db_updated_with_new_score(self, scored_block_usage_key, **kwargs) if not has_database_updated: - raise DatabaseNotReadyError + raise ScoreNotFoundError _update_subsection_grades( course_key,