def get_surveys():
    surveys_metadata, _ = fetch_survey_and_collection_exercise_metadata()

    return render_template(
        'dashboard.html',
        all_surveys=surveys_metadata
    )
Exemplo n.º 2
0
    def fetch_mock_survey_and_collection_exercises_response(self):
        # Requires @responses.activate
        with self.app.app_context():
            # Mock the survey and collection exercise services
            responses.add(responses.GET,
                          self.app.config['SURVEY_URL'] + '/surveys',
                          json=self.surveys_response)
            responses.add(responses.GET,
                          self.app.config['COLLECTION_EXERCISE_URL'] +
                          '/collectionexercises',
                          json=self.collection_exercises_response)

            surveys, collection_exercises = fetch_survey_and_collection_exercise_metadata(
            )
        return collection_exercises, surveys
def get_dashboard_for_collection_exercise(collection_exercise_id):
    surveys_metadata, collection_exercise_metadata = fetch_survey_and_collection_exercise_metadata()
    try:
        collection_exercise = collection_exercise_metadata[collection_exercise_id]
        return render_template(
            'reporting.html',
            collex_id=collection_exercise_id,
            all_surveys=surveys_metadata,
            survey_short_name=collection_exercise['shortName'],
            survey_long_name=collection_exercise['longName'],
            survey_id=collection_exercise['surveyId'],
            collection_exercise_description=collection_exercise['userDescription'],
            reporting_refresh_cycle=int(current_app.config['REPORTING_REFRESH_CYCLE_IN_SECONDS'])
        )
    except KeyError:
        abort(404)