From eb2b51d02eeef698042ed30b64467642ab3ec8d5 Mon Sep 17 00:00:00 2001 From: Mushtaq Rossier Date: Wed, 5 Jun 2024 11:09:18 +0200 Subject: [PATCH] feat: Added extra info logs for refundable method --- common/djangoapps/student/models/course_enrollment.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/common/djangoapps/student/models/course_enrollment.py b/common/djangoapps/student/models/course_enrollment.py index 318a3afd83..8d1b672693 100644 --- a/common/djangoapps/student/models/course_enrollment.py +++ b/common/djangoapps/student/models/course_enrollment.py @@ -1016,18 +1016,22 @@ class CourseEnrollment(models.Model): self.course_id ) if certificate and not CertificateStatuses.is_refundable_status(certificate.status): + log.info(f"{self.user} has already been given a certificate therefore cannot be refunded.") return False # If it is after the refundable cutoff date they should not be refunded. refund_cutoff_date = self.refund_cutoff_date() # `refund_cuttoff_date` will be `None` if there is no order. If there is no order return `False`. if refund_cutoff_date is None: + log.info("Refund cutoff date is null") return False if datetime.now(UTC) > refund_cutoff_date: + log.info(f"Refund cutoff date: {refund_cutoff_date} has passed") return False course_mode = CourseMode.mode_for_course(self.course_id, 'verified', include_expired=True) if course_mode is None: + log.info(f"Course mode for {self.course_id} doesn't exist.") return False else: return True