From 46550ca0627c1d758923439479687c34c9c5aeb5 Mon Sep 17 00:00:00 2001 From: Guillaume Pellerin Date: Wed, 29 Jun 2022 23:45:58 +0200 Subject: [PATCH] add soft exception --- .../teleforma-publish-notify-conferences.py | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/teleforma/management/commands/teleforma-publish-notify-conferences.py b/teleforma/management/commands/teleforma-publish-notify-conferences.py index 3357f77a..464ef8a6 100644 --- a/teleforma/management/commands/teleforma-publish-notify-conferences.py +++ b/teleforma/management/commands/teleforma-publish-notify-conferences.py @@ -66,13 +66,17 @@ class Command(BaseCommand): students = Student.objects.filter(period=conference.period) for student in students: - if student.user: - courses = get_courses(student.user, period=conference.period) - for course in courses: - if conference.course == course['course'] and \ - conference.course_type in course['types']: - notify(student.user, message, url) - logger.logger.info("Student notified: " + student.user.username) + try: + if student.user: + courses = get_courses(student.user, period=conference.period) + for course in courses: + if conference.course == course['course'] and \ + conference.course_type in course['types']: + notify(student.user, message, url) + logger.logger.info("Student notified: " + student.user.username) + except: + logger.logger.info("Student NOT notified: " + student.user.username) + continue conference.notified = True conference.save() -- 2.39.5