예제 #1
0
def regular_checkins():
    """A recurring task which sends checkin emails to members"""
    # Pull the memberships that started 60 days ago and send the coworking survey
    # if they are still active and this was their first membership
    today = localtime(now()).date()
    two_months_ago = today - timedelta(days=60)
    for membership in Membership.objects.filter(start_date=two_months_ago):
        if OldMembership.objects.filter(
                user=membership.user,
                start_date__lt=two_months_ago).count() == 0:
            if membership.user.profile.is_active():
                email.send_member_survey(membership.user)

    # Pull all the free trials from 30 days ago and send an email if they haven't been back
    one_month_ago = today - timedelta(days=30)
    for dropin in CoworkingDay.objects.filter(visit_date=one_month_ago,
                                              payment='Trial'):
        if CoworkingDay.objects.filter(user=dropin.user).count() == 1:
            if not dropin.user.profile.is_active():
                email.send_no_return_checkin(dropin.user)

    # Send an exit survey to members that have been gone a week.
    one_week_ago = today - timedelta(days=7)
    for membership in Membership.objects.filter(end_date=one_week_ago):
        if not membership.user.profile.is_active():
            email.send_exit_survey(membership.user)
예제 #2
0
 def handle(*args, **options):
     # Pull the memberships that started 2 months ago and send a survey
     # if they are still active and this was their first membership
     today = localtime(now()).date()
     two_months_ago = today - relativedelta(months=2)
     for membership in Membership.objects.filter(start_date=two_months_ago):
         if Membership.objects.filter(
                 user=membership.user,
                 start_date__lt=two_months_ago).count() == 0:
             if membership.user.profile.is_active():
                 email.send_member_survey(membership.user)
예제 #3
0
 def handle(self, *args, **options):
     # Pull the subscriptions that started 2 months ago and send a survey
     # if they are still active and this was their first membership
     today = localtime(now()).date()
     two_months_ago = today - relativedelta(months=2)
     print(("Checking for subscriptions starting on: %s" % two_months_ago))
     for subscription in ResourceSubscription.objects.filter(start_date=two_months_ago):
         user = subscription.user
         membership = Membership.objects.for_user(user)
         first_membership = ResourceSubscription.objects.filter(membership=membership, start_date__lt=two_months_ago).count() == 0
         is_active = user.profile.is_active(today)
         if first_membership and is_active:
             print(("  Sending membership survey to %s" % user.get_full_name()))
             email.send_member_survey(membership.user)
예제 #4
0
 def handle(self, *args, **options):
     # Pull the subscriptions that started 2 months ago and send a survey
     # if they are still active and this was their first membership
     today = localtime(now()).date()
     two_months_ago = today - relativedelta(months=2)
     print("Checking for subscriptions starting on: %s" % two_months_ago)
     for subscription in ResourceSubscription.objects.filter(start_date=two_months_ago):
         user = subscription.user
         membership = Membership.objects.for_user(user)
         first_membership = ResourceSubscription.objects.filter(membership=membership, start_date__lt=two_months_ago).count() == 0
         is_active = user.profile.is_active(today)
         if first_membership and is_active:
             print("  Sending membership survey to %s" % user.get_full_name())
             email.send_member_survey(membership.user)
예제 #5
0
def regular_checkins():
    """A recurring task which sends checkin emails to members"""
    # Pull the memberships that started 60 days ago and send the coworking survey
    # if they are still active and this was their first membership
    two_months_ago = timezone.localtime(timezone.now()) - timedelta(days=60)
    for membership in Membership.objects.filter(start_date=two_months_ago):
        if Membership.objects.filter(user=membership.user, start_date__lt=two_months_ago).count() == 0:
            if membership.user.profile.is_active():
                email.send_member_survey(membership.user)

    # Pull all the free trials from 30 days ago and send an email if they haven't been back
    one_month_ago = timezone.localtime(timezone.now()) - timedelta(days=30)
    for dropin in CoworkingDay.objects.filter(visit_date=one_month_ago, payment='Trial'):
        if CoworkingDay.objects.filter(user=dropin.user).count() == 1:
            if not dropin.user.profile.is_active():
                email.send_no_return_checkin(dropin.user)

    # Send an exit survey to members that have been gone a week.
    one_week_ago = timezone.localtime(timezone.now()) - timedelta(days=7)
    for membership in Membership.objects.filter(end_date=one_week_ago):
        if not membership.user.profile.is_active():
            email.send_exit_survey(membership.user)