From 45d5a7c6161d49f75672d3f193aa83b7f7154bc2 Mon Sep 17 00:00:00 2001 From: gzbender Date: Wed, 5 Dec 2018 23:08:00 +0300 Subject: [PATCH] =?UTF-8?q?LIL-711=20=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=B8?= =?UTF-8?q?=D1=82=D1=8C=20=D0=B2=20SendGrid=20=D0=BF=D0=BE=D0=BB=D0=B5=20c?= =?UTF-8?q?ourse=20payment?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/notification/tasks.py | 3 +++ 1 file changed, 3 insertions(+) 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()