예제 #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
 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])