Example #1
0
def send_start_notifications():
    active_surveys = Survey.find_all(Survey.is_active, ~Survey.start_notification_sent, Survey.notifications_enabled)
    try:
        for survey in active_surveys:
            survey.send_start_notification()
    finally:
        db.session.commit()
Example #2
0
    def _process(self):
        surveys = Survey.find_all(Survey.is_visible, Survey.event_id == int(self.event.id),
                                  _eager=(Survey.questions, Survey.submissions))
        if _can_redirect_to_single_survey(surveys):
            return redirect(url_for('.display_survey_form', surveys[0]))

        return self.view_class.render_template('display/survey_list.html', self.event, surveys=surveys,
                                               event=self.event, states=SurveyState,
                                               was_survey_submitted=was_survey_submitted)
Example #3
0
    def _process(self):
        surveys = Survey.find_all(Survey.is_visible, Survey.event_id == int(self.event.id),
                                  _eager=(Survey.questions, Survey.submissions))
        if _can_redirect_to_single_survey(surveys):
            return redirect(url_for('.display_survey_form', surveys[0]))

        return self.view_class.render_template('display/survey_list.html', self.event, surveys=surveys,
                                               event=self.event, states=SurveyState,
                                               was_survey_submitted=was_survey_submitted)
Example #4
0
    def _process(self):
        form = make_survey_form(self.survey)()
        if form.validate_on_submit():
            submission = self._save_answers(form)
            save_submitted_survey_to_session(submission)
            self.survey.send_submission_notification(submission)
            flash(_('Your answers has been saved'), 'success')
            return redirect(url_for('.display_survey_list', self.event))

        surveys = Survey.find_all(Survey.is_visible, Survey.event_id == int(self.event.id))
        if not _can_redirect_to_single_survey(surveys):
            back_button_endpoint = '.display_survey_list'
        elif self.event.getType() != 'conference':
            back_button_endpoint = 'event.conferenceDisplay'
        else:
            back_button_endpoint = None
        return self.view_class.render_template('display/survey_questionnaire.html', self.event, form=form,
                                               event=self.event, survey=self.survey,
                                               back_button_endpoint=back_button_endpoint)
Example #5
0
    def _process(self):
        form = make_survey_form(self.survey)()
        if form.validate_on_submit():
            submission = self._save_answers(form)
            save_submitted_survey_to_session(submission)
            self.survey.send_submission_notification(submission)
            flash(_('Your answers has been saved'), 'success')
            return redirect(url_for('.display_survey_list', self.event))

        surveys = Survey.find_all(Survey.is_visible, Survey.event_id == int(self.event.id))
        if not _can_redirect_to_single_survey(surveys):
            back_button_endpoint = '.display_survey_list'
        elif self.event.getType() != 'conference':
            back_button_endpoint = 'event.conferenceDisplay'
        else:
            back_button_endpoint = None
        return self.view_class.render_template('display/survey_questionnaire.html', self.event, form=form,
                                               event=self.event, survey=self.survey,
                                               back_button_endpoint=back_button_endpoint)