dongwook-chan's picture
Finished developing back-end
2e9ea78
raw
history blame
943 Bytes
from flask import Blueprint, render_template, redirect, url_for, jsonify
from flask import session
import random
from ice_breaking_challenge import quiz_generated
import time
bp = Blueprint("topic", __name__, url_prefix="/topic")
topics = ["๋ฐ˜๋ง ๋ชจ๋“œ๋ฅผ ํ•ด๋ณด์‹œ๋Š” ๊ฑด ์–ด๋– ์„ธ์š”?", "์˜ค๋Š˜ ๋‚ฎ์— ํ•œ ์ผ์„ ๊ณต์œ ํ•ด๋ณด์„ธ์š”!", "์•„์นจํ˜• ์ธ๊ฐ„์ธ๊ฐ€์š”, ์ €๋…ํ˜• ์ธ๊ฐ„์ธ๊ฐ€์š”?",
"MBTI๊ฐ€ ๋ฌด์—‡์ธ๊ฐ€์š”? ๋Œ€ํ™”ํ•ด๋ณด๋ฉฐ ๋งž์ถฐ๋ณด์„ธ์š”!", "์„œ๋กœ์˜ ์ทจ๋ฏธ๋ฅผ ํ•œ ๊ฐ€์ง€์”ฉ ๊ณต์œ ํ•ด๋ณผ๊นŒ์š”?", "๋‚˜์ด๋Œ€๊ฐ€ ์–ด๋–ป๊ฒŒ ๋˜์„ธ์š”? ๋™๊ฐ‘์ด ์žˆ๋Š”์ง€ ์ฐพ์•„๋ณผ๊นŒ์š”?",
"์„œ๋กœ ์ด๋ฆ„ ๋Œ€์‹  ๋‹‰๋„ค์ž„์„ ํ•˜๋‚˜ ์ •ํ•ด์„œ ๋ถˆ๋Ÿฌ๋ณผ๊นŒ์š”?"]
@bp.route("/", methods=["GET"])
def topic() -> None:
if quiz_generated[session.sid]:
return redirect(url_for("quiz.quiz"))
else:
selected_topic = random.choice(topics)
return render_template("topic.html", topic=selected_topic)