Beispiel #1
0
 def get(self, survey_id: str):
     stats = aggregation_api.get_question_stats
     survey_stats = get_stats(self.db, survey_id, email=self.current_user)
     question_stats = stats(self.db, survey_id, email=self.current_user)
     survey = survey_select(self.db, survey_id, email=self.current_user)
     self.render('view-survey-data.html', message=None, survey=survey,
                 question_stats=question_stats, survey_stats=survey_stats)
Beispiel #2
0
    def get(self, survey_id: str):
        location_questions = []
        survey_stats = get_stats(self.db, survey_id, email=self.current_user)
        question_stats = get_question_stats(
            self.db, survey_id, email=self.current_user)
        for result in question_stats['result']:
            question = result['question']
            question_type = question[6]
            if question_type == "location":
                question_id = question[0]
                answers = get_answers_for_question(self.db, question_id)
                map_data = list(self._get_map_data(answers))
                location_questions.append({
                    "question_id": question_id,
                    "map_data": map_data
                })

        survey = survey_select(self.db, survey_id, email=self.current_user)
        self.render('view-survey-data.html', message=None, survey=survey,
                    question_stats=question_stats, survey_stats=survey_stats,
                    location_questions=location_questions)
Beispiel #3
0
 def get(self, survey_id: str):
     email = self.get_email()
     self.write(survey_api.get_stats(self.db, survey_id, email=email))