dongwook-chan's picture
Finished developing back-end
2e9ea78
raw
history blame
771 Bytes
from flask import Blueprint, render_template, session
from flask import request, redirect, url_for
from ice_breaking_challenge import quiz_results
bp = Blueprint("quiz", __name__, url_prefix="/quiz")
@bp.route("/", methods=["GET", "POST"])
def quiz():
"""quiz"""
quizzes = quiz_results[session.sid]
if 'question_number' not in session:
session['question_number'] = 0
else:
session['question_number'] += 1
if session['question_number'] == 2: # TODO:
return redirect(url_for("quiz.finish"))
print(session['question_number'])
quiz = quizzes[session['question_number']]
return render_template("quiz.html", quiz=quiz)
@bp.route("/finish", methods=["GET"])
def finish():
return render_template("finish.html")