diff --git a/apps/notification/tasks.py b/apps/notification/tasks.py index 03f3cc9e..243be211 100644 --- a/apps/notification/tasks.py +++ b/apps/notification/tasks.py @@ -84,6 +84,8 @@ def sendgrid_update_recipients(): for user in users: last_course_purchase = course_payments.get(user.id) and course_payments.get(user.id).strftime(date_format) last_school_purchase = school_payments.get(user.id) and school_payments.get(user.id).strftime(date_format) + courses_purchased = CoursePayment.objects.filter(user=user, + status__in=CoursePayment.PW_PAID_STATUSES).values_list('course_id', flat=True) data.append({ 'first_name': user.first_name, 'last_name': user.last_name, @@ -94,6 +96,7 @@ def sendgrid_update_recipients(): # 'gender': {User.NOT_DEFINED: '', User.MALE: 'Мужчина', User.FEMALE: 'Женщина'}[user.gender] if user.gender else '', 'birthday': user.birthday and user.birthday.strftime(date_format), 'date_joined': user.date_joined.strftime(date_format), + 'courses_purchased': ','.join(map(str, courses_purchased)) + ',' if courses_purchased else '', }) sg = get_sendgrid_client()