def get_simple_survey(survey_id): try: s_id = HashId.decode(survey_id) svey = Survey.objects(id = s_id).first() if svey is None: raise TypeError if not svey.active: raise ViewException("This Survey is not accepting Responses at this moment", 403) except TypeError: raise ViewException("Invalid Survey ID", 404) return app.send_static_file('simplesurvey/index.simplesurvey.html')
def get_gamified_survey(survey_id): try: s_id = HashId.decode(survey_id) svey = Survey.objects(id = s_id).first() if svey is None: raise TypeError if not svey.active: raise ViewException("This Survey is not accepting Responses at this moment", 403) if not svey.gamified_enabled: raise ViewException("This Survey cannot be rendered as a Game.", 403) except TypeError: raise ViewException("Invalid Survey ID", 404) return app.send_static_file('gamified/index.html')
def gamified_assets_2(survey_id, filename): new_path = 'gamified/TemplateData/{0}'.format(filename) return app.send_static_file(new_path)
def gamified_assets(survey_id, filename): new_path = 'gamified/Compressed/{0}gz'.format(filename) print(new_path) g.gzip = True return app.send_static_file(new_path)