コード例 #1
0
def _can_redirect_to_single_survey(surveys):
    # Make sure redirection to first survey does not happen before login if user is required.
    if not session.user and len(
            surveys) == 1 and surveys[0].is_active and surveys[0].require_user:
        return False

    return len(
        surveys) == 1 and surveys[0].is_active and not was_survey_submitted(
            surveys[0])
コード例 #2
0
ファイル: display.py プロジェクト: nyimbi/indico
    def _checkParams(self, params):
        RHSurveyBaseDisplay._checkParams(self, params)
        self.survey = (Survey.query
                       .filter(Survey.id == request.view_args['survey_id'], Survey.is_visible)
                       .options(joinedload('submissions'),
                                joinedload('sections').joinedload('children'))
                       .one())

        if not self.survey.is_active:
            flash(_('This survey is not active'), 'error')
            return redirect(url_for('.display_survey_list', self.event_new))
        elif was_survey_submitted(self.survey):
            flash(_('You have already answered this survey'), 'error')
            return redirect(url_for('.display_survey_list', self.event_new))
コード例 #3
0
ファイル: display.py プロジェクト: hennogous/indico
    def _checkParams(self, params):
        RHSurveyBaseDisplay._checkParams(self, params)
        self.survey = (Survey
                       .find(Survey.id == request.view_args['survey_id'], Survey.is_visible)
                       .options(joinedload(Survey.submissions))
                       .options(joinedload(Survey.sections).joinedload(SurveySection.children))
                       .one())

        if not self.survey.is_active:
            flash(_('This survey is not active'), 'error')
            return redirect(url_for('.display_survey_list', self.event))
        elif was_survey_submitted(self.survey):
            flash(_('You have already answered this survey'), 'error')
            return redirect(url_for('.display_survey_list', self.event))
コード例 #4
0
ファイル: display.py プロジェクト: indico/indico
    def _checkParams(self, params):
        RHSurveyBaseDisplay._checkParams(self, params)
        self.survey = (
            Survey.query.filter(Survey.id == request.view_args["survey_id"], Survey.is_visible)
            .options(joinedload("submissions"), joinedload("sections").joinedload("children"))
            .one()
        )

        if not self.survey.is_active:
            flash(_("This survey is not active"), "error")
            return redirect(url_for(".display_survey_list", self.event_new))
        elif was_survey_submitted(self.survey):
            flash(_("You have already answered this survey"), "error")
            return redirect(url_for(".display_survey_list", self.event_new))
コード例 #5
0
ファイル: display.py プロジェクト: DirkHoffmann/indico
 def _process_args(self):
     RHSurveyBaseDisplay._process_args(self)
     self.survey = (Survey.query
                    .filter(Survey.id == request.view_args['survey_id'], Survey.is_visible)
                    .options(joinedload('submissions'),
                             joinedload('sections').joinedload('children'))
                    .one())
     self.submission = (session.user.survey_submissions.filter_by(survey=self.survey, is_submitted=False).first()
                        if session.user else None)
     if not self.survey.is_active:
         flash(_('This survey is not active'), 'error')
         return redirect(url_for('.display_survey_list', self.event))
     elif was_survey_submitted(self.survey):
         flash(_('You have already answered this survey'), 'error')
         return redirect(url_for('.display_survey_list', self.event))
コード例 #6
0
ファイル: display.py プロジェクト: mkopcic/indico
 def _process_args(self):
     RHSurveyBaseDisplay._process_args(self)
     self.survey = (Survey.query
                    .filter(Survey.id == request.view_args['survey_id'], Survey.is_visible)
                    .options(joinedload('submissions'),
                             joinedload('sections').joinedload('children'))
                    .one())
     self.submission = (session.user.survey_submissions.filter_by(survey=self.survey, is_submitted=False).first()
                        if session.user else None)
     if not self.survey.is_active:
         flash(_('This survey is not active'), 'error')
         return redirect(url_for('.display_survey_list', self.event))
     elif was_survey_submitted(self.survey):
         flash(_('You have already answered this survey'), 'error')
         return redirect(url_for('.display_survey_list', self.event))
コード例 #7
0
ファイル: display.py プロジェクト: hennogous/indico
def _can_redirect_to_single_survey(surveys):
    return len(surveys) == 1 and surveys[0].is_active and not was_survey_submitted(surveys[0])
コード例 #8
0
ファイル: display.py プロジェクト: imfht/flaskapps
def _can_redirect_to_single_survey(surveys):
    return len(
        surveys) == 1 and surveys[0].is_active and not was_survey_submitted(
            surveys[0])