Example #1
0
 def get(self, submission_id: str):
     """GET the visualization page."""
     submission = get_submission_for_handler(self, submission_id)
     survey = get_survey_for_handler(self, submission.survey_id)
     self.render(
         'view_submission.html', survey=survey, submission=submission
     )
Example #2
0
 def get(self, survey_id: str):
     """GET the admin page for a survey."""
     # TODO: should this be done in JS?
     survey = get_survey_for_handler(self, survey_id)
     self.render(
         'view_survey.html',
         survey=survey,
     )
Example #3
0
    def get(self, survey_id: str):
        """GET the data page."""
        survey = get_survey_for_handler(self, survey_id)

        # Sometimes during a test run the session reports that the survey has
        # no nodes (even though the database says otherwise). I haven't seen it
        # occur in normal usage... but this seems safe enough.
        self.session.refresh(survey)

        question_stats = list(generate_question_stats(survey))
        location_stats = self._get_map_data(
            stat['survey_node'] for stat in question_stats
        )
        self.render(
            'view_data.html',
            survey=survey,
            question_stats=question_stats,
            location_stats=location_stats,
        )
Example #4
0
    def get(self, survey_id):
        """GET the main survey view.

        Render survey page for given survey id, embed JSON into to template so
        browser can cache survey in HTML.

        Raises tornado http error.

        @survey_id: Requested survey id.
        """
        try:
            survey = get_survey_for_handler(self, survey_id)
        except Unauthorized:
            return auth_redirect(self)
        except SurveyAccessForbidden:
            raise tornado.web.HTTPError(403)

        # pass in the revisit url
        self.render('view_enumerate.html',
                    current_user_model=self.current_user_model,
                    survey=survey,
                    revisit_url=options.revisit_url)
Example #5
0
    def get(self, survey_id):
        """GET the main survey view.

        Render survey page for given survey id, embed JSON into to template so
        browser can cache survey in HTML.

        Raises tornado http error.

        @survey_id: Requested survey id.
        """
        try:
            survey = get_survey_for_handler(self, survey_id)
        except Unauthorized:
            return auth_redirect(self)
        except SurveyAccessForbidden:
            raise tornado.web.HTTPError(403)

        # pass in the revisit url
        self.render(
            'view_enumerate.html',
            current_user_model=self.current_user_model,
            survey=survey,
            revisit_url=options.revisit_url
        )