Esempio n. 1
0
def send_survey_mail(self, logger_context=None):
    self.setup_logger(logger_context)

    surveys = Survey.objects.filter(active_from__lte=timezone.now(),
                                    sent=False,
                                    template_type=None)
    for survey in surveys.all():
        for registration in survey.event.registrations.filter(
                presence=PRESENT):
            notification = SurveyNotification(registration.user, survey=survey)
            notification.notify()
            track(registration.user,
                  'survey.create',
                  properties={'survey_id': survey.id})
        survey.sent = True
        survey.save()
Esempio n. 2
0
 def setUp(self):
     self.survey = Survey.objects.first()
     self.recipient = User.objects.first()
     self.notifier = SurveyNotification(user=self.recipient,
                                        survey=self.survey)