diff --git a/lms/djangoapps/grades/models.py b/lms/djangoapps/grades/models.py index a0e398976d..7644334655 100644 --- a/lms/djangoapps/grades/models.py +++ b/lms/djangoapps/grades/models.py @@ -436,6 +436,13 @@ class PersistentSubsectionGrade(TimeStampedModel): usage_key=usage_key, defaults=params, ) + + # TODO: Remove as part of EDUCATOR-4602. + if str(usage_key.course_key) == 'course-v1:UQx+BUSLEAD5x+2T2019': + log.info(u'Created/updated grade ***{}*** for user ***{}*** in course ***{}***' + u'for subsection ***{}*** with default params ***{}***' + .format(grade, user_id, usage_key.course_key, usage_key, params)) + grade.override = PersistentSubsectionGradeOverride.get_override(user_id, usage_key) if first_attempted is not None and grade.first_attempted is None: grade.first_attempted = first_attempted @@ -717,6 +724,12 @@ class PersistentSubsectionGradeOverride(models.Model): grade_defaults = cls._prepare_override_params(subsection_grade_model, override_data) grade_defaults['override_reason'] = override_data['comment'] if 'comment' in override_data else None grade_defaults['system'] = override_data['system'] if 'system' in override_data else None + + # TODO: Remove as part of EDUCATOR-4602. + if str(subsection_grade_model.course_id) == 'course-v1:UQx+BUSLEAD5x+2T2019': + log.info(u'Creating override for user ***{}*** for PersistentSubsectionGrade' + u'***{}*** with override data ***{}*** and derived grade_defaults ***{}***.' + .format(requesting_user, subsection_grade_model, override_data, grade_defaults)) override, _ = PersistentSubsectionGradeOverride.objects.update_or_create( grade=subsection_grade_model, defaults=grade_defaults, diff --git a/lms/djangoapps/grades/rest_api/v1/gradebook_views.py b/lms/djangoapps/grades/rest_api/v1/gradebook_views.py index 283db3d55c..1266172b0e 100644 --- a/lms/djangoapps/grades/rest_api/v1/gradebook_views.py +++ b/lms/djangoapps/grades/rest_api/v1/gradebook_views.py @@ -823,6 +823,11 @@ class GradebookBulkUpdateView(GradeViewMixin, PaginatedAPIView): subsection = course.get_child(usage_key) if subsection: subsection_grade_model = self._create_subsection_grade(user, course, subsection) + # TODO: Remove as part of EDUCATOR-4602. + if str(course_key) == 'course-v1:UQx+BUSLEAD5x+2T2019': + log.info(u'PersistentSubsectionGrade ***{}*** created for' + u' subsection ***{}*** in course ***{}*** for user ***{}***.' + .format(subsection_grade_model, subsection.location, course, user.id)) else: self._log_update_result(request.user, requested_user_id, requested_usage_id, success=False) result.append(GradebookUpdateResponseItem( diff --git a/lms/djangoapps/grades/subsection_grade.py b/lms/djangoapps/grades/subsection_grade.py index b6404ffbfd..e1c5de9a91 100644 --- a/lms/djangoapps/grades/subsection_grade.py +++ b/lms/djangoapps/grades/subsection_grade.py @@ -262,11 +262,23 @@ class CreateSubsectionGrade(NonZeroSubsectionGrade): start_node=subsection.location, ): problem_score = self._compute_block_score(block_key, course_structure, submissions_scores, csm_scores) + + # TODO: Remove as part of EDUCATOR-4602. + if str(block_key.course_key) == 'course-v1:UQx+BUSLEAD5x+2T2019': + log.info(u'Calculated problem score ***{}*** for block ***{!s}***' + u' in subsection ***{}***.' + .format(problem_score, block_key, subsection.location)) if problem_score: self.problem_scores[block_key] = problem_score all_total, graded_total = graders.aggregate_scores(list(self.problem_scores.values())) + # TODO: Remove as part of EDUCATOR-4602. + if str(subsection.location.course_key) == 'course-v1:UQx+BUSLEAD5x+2T2019': + log.info(u'Calculated aggregate all_total ***{}***' + u' and grade_total ***{}*** for subsection ***{}***' + .format(all_total, graded_total, subsection.location)) + super(CreateSubsectionGrade, self).__init__(subsection, all_total, graded_total) def update_or_create_model(self, student, score_deleted=False, force_update_subsections=False): @@ -274,6 +286,11 @@ class CreateSubsectionGrade(NonZeroSubsectionGrade): Saves or updates the subsection grade in a persisted model. """ if self._should_persist_per_attempted(score_deleted, force_update_subsections): + # TODO: Remove as part of EDUCATOR-4602. + if str(self.location.course_key) == 'course-v1:UQx+BUSLEAD5x+2T2019': + log.info(u'Updating PersistentSubsectionGrade for student ***{}*** in' + u' subsection ***{}*** with params ***{}***.' + .format(student.id, self.location, self._persisted_model_params(student))) model = PersistentSubsectionGrade.update_or_create_grade(**self._persisted_model_params(student)) if hasattr(model, 'override'):