Spaces:
Runtime error
Runtime error
File size: 1,501 Bytes
4dd778b df42f36 c90fe2b df42f36 658dbbd df42f36 11133ef c90fe2b df42f36 044d0ec df42f36 b3393c0 df42f36 c90fe2b df42f36 4dd778b 11133ef d8529e7 11133ef 4dd778b 11133ef |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
from collections import Counter
from flask import Blueprint
from flask import flash
from flask import g
from flask import redirect
from flask import render_template
from flask import request
from flask import url_for
from werkzeug.exceptions import abort
from flask import session
from threading import Thread
from .auth import login_required
from .db import get_db
from ice_breaking_challenge.google_sheets import get_team_numbers, get_questions_and_answers
from ice_breaking_challenge import background_task
bp = Blueprint("qr", __name__, url_prefix="/qr")
@bp.route("/", methods=["GET", "POST"])
def qr() -> None:
match request.method:
case "GET":
return render_template("qr.html")
case "POST": # qr.htmlμμ `λ€μ` λ²νΌ λλ μ λ
counter = Counter(get_team_numbers())
if session.get("team_number") not in counter:
flash("ν΄λΉ ν λ²νΈκ° μ‘΄μ¬νμ§ μμ΅λλ€.")
return render_template("index.html")
if counter[session.get("team_number")] == int(session["team_size"]):
qna = get_questions_and_answers()
Thread(target=background_task, args=(session.sid, qna)).start()
import time
time.sleep(100)
return render_template("introduction.html")
else:
flash("μ€λ¬Έμ μλ£νμ§ μμ νμμ΄ μμ΅λλ€.")
return render_template("qr.html")
|