diff --git a/apps/notification/tasks.py b/apps/notification/tasks.py index 0a3e09cd..7430e0b9 100644 --- a/apps/notification/tasks.py +++ b/apps/notification/tasks.py @@ -12,7 +12,7 @@ from django.conf import settings from apps.notification.models import UserNotification from apps.notification.utils import send_email -from apps.payment.models import SchoolPayment, CoursePayment, Payment, UserGiftCertificate +from apps.payment.models import SchoolPayment, CoursePayment, Payment, UserGiftCertificate, UserBonus from project.celery import app from project.utils.db import format_sql, execute_sql from project.sengrid import get_sendgrid_client @@ -143,3 +143,11 @@ def send_gift_certificate(user_gift_certificate): send_email('Подарочный сертификат от Lil School', user_gift_certificate.user.email, 'notification/email/gift_certificate.html', inline_images=[('twitter_icon', 'img/twitter.png'), ('fb_icon', 'img/fb.png'), ('instagram_icon', 'img/instagram.png'),], user_gift_certificate=user_gift_certificate, gift_certificate=user_gift_certificate.gift_certificate) + + +@app.task +def send_child_birthday_bonuses(): + for u in User.objects.exclude(child_first_name='', child_last_name='',).filter(child_birthday=now().date()): + if not UserBonus.objects.filter(user=u, is_service=True, action_name=UserBonus.ACTION_CHILD_BIRTHDAY).count(): + UserBonus.objects.create(user=u, amount=UserBonus.AMOUNT_CHILD_BIRTHDAY, is_service=True, + action_name=UserBonus.ACTION_CHILD_BIRTHDAY) diff --git a/apps/user/templates/user/bonus-history.html b/apps/user/templates/user/bonus-history.html index 211bf9f5..8a66485f 100644 --- a/apps/user/templates/user/bonus-history.html +++ b/apps/user/templates/user/bonus-history.html @@ -50,7 +50,7 @@
{% endif %}
{% endif %}
{% endif %}
{% endif %}