Ejemplo n.º 1
0
    def do(self):
        # Find all Families, which has an updated_dtm older than the specified time for updates from today.
        # Exclude the families which has already received a notification after they updated last.
        # (to avoid sending again)
        outdated_dtm = timezone.now() - datetime.timedelta(days=settings.REQUEST_FAMILY_VALIDATION_PERIOD)
        unconfirmed_families = Family.objects.filter(Q(confirmed_dtm__lt=outdated_dtm) | Q(confirmed_dtm=None)).exclude(Q(notification__update_info_dtm__gt=F('confirmed_dtm')) | Q(~Q(notification__update_info_dtm=None), confirmed_dtm=None))

        # send notification to all families asking them to update
        # their family details
        for family in unconfirmed_families:
            email = EmailTemplate.objects.get(idname='UPDATE_DATA').makeEmail(family, {})[0]
            notification = Notification(family=family, email=email, update_info_dtm=timezone.now())
            notification.save()
Ejemplo n.º 2
0
    def do(self):
        # Find all Families, which has an updated_dtm older than the specified time for updates from today.
        # Exclude the families which has already received a notification after they updated last.
        # (to avoid sending again)
        outdated_dtm = timezone.now() - datetime.timedelta(days=settings.REQUEST_FAMILY_VALIDATION_PERIOD)
        unconfirmed_families = Family.objects.filter(Q(confirmed_dtm__lt=outdated_dtm) | Q(confirmed_dtm=None)).exclude(Q(notification__update_info_dtm__gt=F('confirmed_dtm')) | Q(~Q(notification__update_info_dtm=None), confirmed_dtm=None))

        # send notification to all families asking them to update
        # their family details
        for family in unconfirmed_families:
            email = EmailTemplate.objects.get(idname='UPDATE_DATA').makeEmail(family, {})[0]
            notification = Notification(family=family, email=email, update_info_dtm=timezone.now())
            notification.save()
Ejemplo n.º 3
0
    def do(self):
        unannounced_signups = ActivityParticipant.objects.exclude(notification__isnull=False).filter(payment__confirmed_dtm__isnull=False)

        for announcement in unannounced_signups:
            context = {
                'activity' : announcement.activity,
                'person' : announcement.member.person,
                'family' : announcement.member.person.family
            }
            emails = EmailTemplate.objects.get(idname='ACT_CONFIRM').makeEmail([announcement.member.person, announcement.member.person.family], context)
            for email in emails:
                notification = Notification(family=announcement.member.person.family, email=email, anounced_activity_participant=announcement)
                notification.save()
Ejemplo n.º 4
0
    def do(self):
        unannounced_signups = ActivityParticipant.objects.exclude(notification__isnull=False).filter(payment__confirmed_dtm__isnull=False)

        for announcement in unannounced_signups:
            context = {
                'activity' : announcement.activity,
                'person' : announcement.member.person,
                'family' : announcement.member.person.family
            }
            emails = EmailTemplate.objects.get(idname='ACT_CONFIRM').makeEmail([announcement.member.person, announcement.member.person.family], context)
            for email in emails:
                notification = Notification(family=announcement.member.person.family, email=email, anounced_activity_participant=announcement)
                notification.save()
Ejemplo n.º 5
0
    def do(self):
        unannounced_signups = ActivityParticipant.objects.exclude(
            notification__isnull=False).filter(
                payment__accepted_dtm__isnull=False)

        for announcement in unannounced_signups:
            context = {
                "activity": announcement.activity,
                "person": announcement.member.person,
                "family": announcement.member.person.family,
                "union": announcement.activity.department.union,
            }
            emails = EmailTemplate.objects.get(idname="ACT_CONFIRM").makeEmail(
                [
                    announcement.member.person,
                    announcement.member.person.family
                ], context)
            for email in emails:
                notification = Notification(
                    family=announcement.member.person.family,
                    email=email,
                    anounced_activity_participant=announcement,
                )
                notification.save()