示例#1
0
def course(course):
    """Redirects to a random question for a chosen course"""
    models.Course.query.filter_by(code=course).first_or_404()
    return redirect(
        url_for('quiz.question_course',
                course_code=course,
                id=utils.random_id(course=course)))
示例#2
0
文件: api.py 项目: duvholt/memorizer
 def get(self, course_code, exam_name=None):
     current = request.args.get('id', -1)
     try:
         current = int(current)
     except ValueError:
         current = -1
     return {'index': utils.random_id(id=current, course=course_code, exam=exam_name)}
示例#3
0
文件: api.py 项目: jloehel/memorizer
 def get(self, course_code, exam_name=None):
     current = request.args.get('id', -1)
     try:
         current = int(current)
     except:
         current = -1
     return {
         'index':
         utils.random_id(id=current, course=course_code, exam=exam_name)
     }
示例#4
0
文件: quiz.py 项目: duvholt/memorizer
    def context(self, *args, **kwargs):
        context = super().context(*args, **kwargs)
        random_question = utils.random_id(id=id, course=self.model.course.code)
        reset_url = url_for('quiz.reset_stats_exam', course=self.model.course.code, exam=self.model.name)

        context.update({
            'exam_name': self.model.name,
            'reset_url': reset_url,
            'random': random_question
        })
        return context
示例#5
0
    def context(self, *args, **kwargs):
        context = super().context(*args, **kwargs)
        reset_url = url_for('quiz.reset_stats_course', course=self.model.code)
        random_question = utils.random_id(id=id, course=self.model.code)

        context.update({
            'exam_name': 'all',
            'reset_url': reset_url,
            'random': random_question
        })
        return context
示例#6
0
文件: quiz.py 项目: duvholt/memorizer
def course(course):
    """Redirects to a random question for a chosen course"""
    models.Course.query.filter_by(code=course).first_or_404()
    return redirect(url_for(
        'quiz.question_course', course_code=course, id=utils.random_id(course=course))
    )