From 8afba9477df6a0e9b4fb3db4ee4d2b92b7ae695d Mon Sep 17 00:00:00 2001 From: gzbender Date: Tue, 28 May 2019 23:30:29 +0300 Subject: [PATCH 1/3] =?UTF-8?q?=D1=80=D0=B8=D1=81=D0=BE=D0=B2=D0=B0=D0=BB?= =?UTF-8?q?=D1=8C=D0=BD=D1=8B=D0=B9=20=D0=BB=D0=B0=D0=B3=D0=B5=D1=80=D1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../templates/notification/email/camp_certificate.html | 8 +++++++- project/settings.py | 5 +++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/apps/notification/templates/notification/email/camp_certificate.html b/apps/notification/templates/notification/email/camp_certificate.html index 98f83bbf..f4152c79 100644 --- a/apps/notification/templates/notification/email/camp_certificate.html +++ b/apps/notification/templates/notification/email/camp_certificate.html @@ -12,10 +12,16 @@ {% endif %} {% if certificate_number == 2 %}

-Вы помните, что каждый месяц вам приходит грамота за прекрасную учебу в рсиовальном лагере?
+Вы помните, что каждый месяц вам приходит грамота за прекрасную учебу в рисовальном лагере?
Скачивайте. Распечатывайте. И соберите свою коллекцию!

{% endif %} + {% if certificate_number == 3 %} +

+Вот и закончился лагерь, пора переходить к основным урокам.
+Спасибо, что были с нами, успехов вам в дальнейшем обучении! +

+ {% endif %}

diff --git a/project/settings.py b/project/settings.py index 2cd1afd3..88f9749d 100644 --- a/project/settings.py +++ b/project/settings.py @@ -277,6 +277,11 @@ CELERY_BEAT_SCHEDULE = { 'schedule': crontab(0, 9, day_of_month='1', month_of_year='8'), 'kwargs': {'certificate_number': 2}, }, + 'send_august_camp_certificates': { + 'task': 'apps.notification.tasks.send_camp_certificates', + 'schedule': crontab(0, 9, day_of_month='1', month_of_year='9'), + 'kwargs': {'certificate_number': 3}, + }, } try: From 5a74af24f0c9db2e93024d2d69a437928215285a Mon Sep 17 00:00:00 2001 From: gzbender Date: Sat, 15 Jun 2019 21:20:54 +0300 Subject: [PATCH 2/3] =?UTF-8?q?=D1=80=D0=B8=D1=81=D0=BE=D0=B2=D0=B0=D0=BB?= =?UTF-8?q?=D1=8C=D0=BD=D1=8B=D0=B9=20=D0=BB=D0=B0=D0=B3=D0=B5=D1=80=D1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/payment/models.py | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/apps/payment/models.py b/apps/payment/models.py index 4f498d9b..5644eb7e 100644 --- a/apps/payment/models.py +++ b/apps/payment/models.py @@ -124,22 +124,6 @@ class Payment(PolymorphicModel): verbose_name_plural = 'Платежи' ordering = ('created_at',) - @classmethod - def add_months(cls, sourcedate, months=1, is_camp=False): - # Лагерь всегда до коонца месяца покупается - if is_camp: - return arrow.get(sourcedate.replace(day=1), settings.TIME_ZONE).shift(months=months).date() - timedelta(1) - # FIXME после мая 2019 убрать? - # Если хотят купить школу в мае, то оплатить ее можно только до 31 мая, потом школа закроется - if sourcedate.month == 5: - return sourcedate.replace(day=31) - result = arrow.get(sourcedate, settings.TIME_ZONE).shift(months=months) - if months == 1: - if (sourcedate.month == 2 and sourcedate.day >= 28) or (sourcedate.day == 31 and result.day <= 30) \ - or (sourcedate.month == 1 and sourcedate.day >= 29 and result.day == 28): - result = result.replace(day=1, month=result.month + 1) - return result.datetime - @classmethod def get_date_range(cls, date_start=None, days=0, months=0, is_camp=False): school_start = date(now().year, 9, 1) @@ -152,6 +136,8 @@ class Payment(PolymorphicModel): if is_camp: if date_start < camp_start: date_start = camp_start + if date_start.month == 6 and date_start.day > 15: + date_start = date_start.replace(month=7, day=1) elif school_end < date_start < school_start: date_start = school_start date_end = arrow.get(date_start + timedelta(days=days), settings.TIME_ZONE).shift(months=months).date() - timedelta(1) From ccf7860f3890bf9734f68f79ba0e0ff59422267f Mon Sep 17 00:00:00 2001 From: gzbender Date: Sat, 15 Jun 2019 21:21:50 +0300 Subject: [PATCH 3/3] =?UTF-8?q?=D1=80=D0=B8=D1=81=D0=BE=D0=B2=D0=B0=D0=BB?= =?UTF-8?q?=D1=8C=D0=BD=D1=8B=D0=B9=20=D0=BB=D0=B0=D0=B3=D0=B5=D1=80=D1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/payment/models.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/payment/models.py b/apps/payment/models.py index 5644eb7e..25aa9e79 100644 --- a/apps/payment/models.py +++ b/apps/payment/models.py @@ -136,7 +136,7 @@ class Payment(PolymorphicModel): if is_camp: if date_start < camp_start: date_start = camp_start - if date_start.month == 6 and date_start.day > 15: + if date_start.month == 6 and date_start.day > 16: date_start = date_start.replace(month=7, day=1) elif school_end < date_start < school_start: date_start = school_start