chore: added debug logs to notifications filters (#33568)

This commit is contained in:
Ahtisham Shahid
2023-10-24 14:42:38 +05:00
committed by GitHub
parent 07ae24aaab
commit 5009d052e5

View File

@@ -30,7 +30,7 @@ class NotificationFilter:
course_time_limit = CourseDurationLimitConfig.current(course_key=course.id)
if not verified_mode:
logger.info(
"Course %s does not have a verified mode, so no users will be filtered out",
"NotificationFilter: Course %s does not have a verified mode, so no users will be filtered out",
course.id,
)
return user_ids
@@ -41,10 +41,13 @@ class NotificationFilter:
)
if course_time_limit.enabled_for_course(course.id):
enrollments = enrollments.filter(created__gte=course_time_limit.enabled_as_of)
logger.info("NotificationFilter: Number of audit enrollments for course %s: %s", course.id, enrollments.count())
for enrollment in enrollments:
content_availability_date = max(enrollment.created, course.start)
expiration_date = content_availability_date + access_duration
logger.info("NotificationFilter: content_availability_date: %s and access_duration: %s",
content_availability_date, access_duration
)
if expiration_date and timezone.now() > expiration_date:
logger.info("User %s has expired audit access to course %s", enrollment.user_id, course.id)
user_ids.remove(enrollment.user_id)
@@ -59,7 +62,7 @@ class NotificationFilter:
course = modulestore().get_course(course_key)
for filter_name in applicable_filters:
logger.info(
"Applying filter %s for notification type %s",
"NotificationFilter: Applying filter %s for notification type %s",
filter_name,
notification_type,
)