Skip to content

Commit

Permalink
chore: added debug logs to notifications filters (#33568)
Browse files Browse the repository at this point in the history
  • Loading branch information
AhtishamShahid authored Oct 24, 2023
1 parent 07ae24a commit 5009d05
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions openedx/core/djangoapps/notifications/filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def filter_audit_expired(user_ids, course) -> list:
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
Expand All @@ -41,10 +41,13 @@ def filter_audit_expired(user_ids, course) -> list:
)
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)
Expand All @@ -59,7 +62,7 @@ def apply_filters(self, user_ids, course_key, notification_type) -> list:
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,
)
Expand Down

0 comments on commit 5009d05

Please sign in to comment.