Spaces:
Runtime error
Runtime error
dongwook-chan
commited on
Commit
โข
775db6c
1
Parent(s):
8241e7f
Update
Browse files- ice_breaking_challenge/background_task.py +5 -2
- ice_breaking_challenge/qr.py +0 -1
- ice_breaking_challenge/quiz.py +6 -2
- ice_breaking_challenge/static/style.css +168 -1
- ice_breaking_challenge/templates/finish.html +5 -3
- ice_breaking_challenge/templates/introduction.html +1 -1
- ice_breaking_challenge/templates/quiz.html +39 -22
- ice_breaking_challenge/templates/topic.html +4 -1
ice_breaking_challenge/background_task.py
CHANGED
@@ -13,7 +13,7 @@ def background_task(sid, qna: pd.DataFrame, team_size: int):
|
|
13 |
import time
|
14 |
start_time = time.time()
|
15 |
|
16 |
-
global quiz_results
|
17 |
quiz_generated[sid] = False
|
18 |
generated_quizzes = generate_quiz(qna, team_size)
|
19 |
quiz_results[sid] = generated_quizzes
|
@@ -81,7 +81,10 @@ def generate_quiz(data: pd.DataFrame, team_size: int):
|
|
81 |
print("==========================================")
|
82 |
|
83 |
question_generated = lines[0]
|
84 |
-
|
|
|
|
|
|
|
85 |
answer_generated = lines[2]
|
86 |
|
87 |
print(question_generated, multiple_choice_generated, answer_generated)
|
|
|
13 |
import time
|
14 |
start_time = time.time()
|
15 |
|
16 |
+
global quiz_results, quiz_generated
|
17 |
quiz_generated[sid] = False
|
18 |
generated_quizzes = generate_quiz(qna, team_size)
|
19 |
quiz_results[sid] = generated_quizzes
|
|
|
81 |
print("==========================================")
|
82 |
|
83 |
question_generated = lines[0]
|
84 |
+
|
85 |
+
tokens = re.split(r'\d+\.\s*', lines[1])
|
86 |
+
multiple_choice_generated = [token.strip() for token in tokens if token]
|
87 |
+
|
88 |
answer_generated = lines[2]
|
89 |
|
90 |
print(question_generated, multiple_choice_generated, answer_generated)
|
ice_breaking_challenge/qr.py
CHANGED
@@ -39,7 +39,6 @@ def qr() -> None:
|
|
39 |
import time
|
40 |
Thread(target=background_task.background_task, args=(session.sid, qna, team_size)).start()
|
41 |
|
42 |
-
|
43 |
# import time
|
44 |
# time.sleep(100)
|
45 |
return redirect(url_for("introduction.introduction"))
|
|
|
39 |
import time
|
40 |
Thread(target=background_task.background_task, args=(session.sid, qna, team_size)).start()
|
41 |
|
|
|
42 |
# import time
|
43 |
# time.sleep(100)
|
44 |
return redirect(url_for("introduction.introduction"))
|
ice_breaking_challenge/quiz.py
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
from flask import Blueprint, render_template, session
|
2 |
-
from flask import
|
3 |
|
4 |
-
from ice_breaking_challenge import quiz_results
|
5 |
|
6 |
bp = Blueprint("quiz", __name__, url_prefix="/quiz")
|
7 |
|
@@ -25,4 +25,8 @@ def quiz():
|
|
25 |
|
26 |
@bp.route("/finish", methods=["GET"])
|
27 |
def finish():
|
|
|
|
|
|
|
|
|
28 |
return render_template("finish.html")
|
|
|
1 |
from flask import Blueprint, render_template, session
|
2 |
+
from flask import redirect, url_for, session
|
3 |
|
4 |
+
from ice_breaking_challenge import quiz_generated, quiz_results
|
5 |
|
6 |
bp = Blueprint("quiz", __name__, url_prefix="/quiz")
|
7 |
|
|
|
25 |
|
26 |
@bp.route("/finish", methods=["GET"])
|
27 |
def finish():
|
28 |
+
global quiz_generated, quiz_results
|
29 |
+
session_id = session.sid
|
30 |
+
del quiz_generated[session_id]
|
31 |
+
del quiz_results[session_id]
|
32 |
return render_template("finish.html")
|
ice_breaking_challenge/static/style.css
CHANGED
@@ -134,4 +134,171 @@ input[type=submit]:hover {
|
|
134 |
|
135 |
input[type=submit]:active {
|
136 |
background: #01579b;
|
137 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
134 |
|
135 |
input[type=submit]:active {
|
136 |
background: #01579b;
|
137 |
+
}
|
138 |
+
|
139 |
+
/* Quiz Title */
|
140 |
+
.quiz-title {
|
141 |
+
color: #0288d1;
|
142 |
+
font-size: 2rem;
|
143 |
+
margin-bottom: 30px;
|
144 |
+
text-transform: uppercase;
|
145 |
+
letter-spacing: 2px;
|
146 |
+
}
|
147 |
+
|
148 |
+
/* Consistent Answer Styling */
|
149 |
+
.correct-answer {
|
150 |
+
font-size: 1.5rem;
|
151 |
+
color: #d32f2f;
|
152 |
+
font-weight: bold;
|
153 |
+
margin-top: 20px;
|
154 |
+
display: none; /* Initially hidden */
|
155 |
+
}
|
156 |
+
|
157 |
+
/* Choices Styling */
|
158 |
+
.choices {
|
159 |
+
font-size: 1.3rem;
|
160 |
+
color: #333;
|
161 |
+
margin-bottom: 30px;
|
162 |
+
list-style-type: none;
|
163 |
+
padding: 0;
|
164 |
+
line-height: 1.8;
|
165 |
+
}
|
166 |
+
|
167 |
+
|
168 |
+
|
169 |
+
/* Submit button for the next quiz */
|
170 |
+
.next-button {
|
171 |
+
background-color: #0288d1;
|
172 |
+
color: white;
|
173 |
+
font-size: 1rem;
|
174 |
+
cursor: pointer;
|
175 |
+
border-radius: 5px;
|
176 |
+
padding: 10px 20px;
|
177 |
+
border: none;
|
178 |
+
transition: background-color 0.3s ease;
|
179 |
+
}
|
180 |
+
|
181 |
+
.next-button:hover {
|
182 |
+
background-color: #0277bd;
|
183 |
+
}
|
184 |
+
|
185 |
+
.next-button:active {
|
186 |
+
background-color: #01579b;
|
187 |
+
}
|
188 |
+
|
189 |
+
/* Container for the quiz */
|
190 |
+
.quiz-container {
|
191 |
+
max-width: 600px;
|
192 |
+
margin: 0 auto;
|
193 |
+
padding: 20px;
|
194 |
+
background-color: #f5f5f5;
|
195 |
+
border-radius: 10px;
|
196 |
+
box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.1);
|
197 |
+
text-align: center;
|
198 |
+
}
|
199 |
+
|
200 |
+
/* Title styling */
|
201 |
+
.quiz-title {
|
202 |
+
color: #0288d1;
|
203 |
+
margin-bottom: 20px;
|
204 |
+
}
|
205 |
+
|
206 |
+
/* Host section aligned right */
|
207 |
+
.quiz-host-container {
|
208 |
+
text-align: right;
|
209 |
+
margin-bottom: 20px;
|
210 |
+
}
|
211 |
+
|
212 |
+
.quiz-host {
|
213 |
+
font-weight: bold;
|
214 |
+
color: #333;
|
215 |
+
}
|
216 |
+
|
217 |
+
.quiz-host-name {
|
218 |
+
color: #2e7d32;
|
219 |
+
}
|
220 |
+
|
221 |
+
/* Question section aligned left */
|
222 |
+
.quiz-question-container {
|
223 |
+
text-align: left;
|
224 |
+
margin-bottom: 20px;
|
225 |
+
}
|
226 |
+
|
227 |
+
.quiz-question {
|
228 |
+
font-weight: bold;
|
229 |
+
color: #003285;
|
230 |
+
font-size: 1.7rem;
|
231 |
+
}
|
232 |
+
|
233 |
+
/* Choices with proper alignment */
|
234 |
+
.choices {
|
235 |
+
text-align: left;
|
236 |
+
margin-bottom: 30px;
|
237 |
+
}
|
238 |
+
|
239 |
+
/* Consistent Answer Styling */
|
240 |
+
.correct-answer {
|
241 |
+
font-size: 1.5rem;
|
242 |
+
color: #d32f2f;
|
243 |
+
font-weight: bold;
|
244 |
+
margin-top: 20px;
|
245 |
+
display: none;
|
246 |
+
}
|
247 |
+
|
248 |
+
/* Show Answer button - blue color theme */
|
249 |
+
.answer-button {
|
250 |
+
background-color: #003285;
|
251 |
+
color: white;
|
252 |
+
padding: 12px 24px;
|
253 |
+
font-size: 1.2rem;
|
254 |
+
border: none;
|
255 |
+
border-radius: 8px;
|
256 |
+
cursor: pointer;
|
257 |
+
font-weight: bold;
|
258 |
+
text-transform: uppercase;
|
259 |
+
transition: background-color 0.3s ease, transform 0.3s ease;
|
260 |
+
margin-bottom: 30px;
|
261 |
+
}
|
262 |
+
|
263 |
+
.answer-button:hover {
|
264 |
+
background-color: #00286A;
|
265 |
+
transform: scale(1.05);
|
266 |
+
}
|
267 |
+
|
268 |
+
.answer-button:active {
|
269 |
+
background-color: #00286A;
|
270 |
+
transform: scale(1.05);
|
271 |
+
}
|
272 |
+
|
273 |
+
/* Submit button for the next quiz */
|
274 |
+
.next-button {
|
275 |
+
background-color: #0288d1;
|
276 |
+
color: white;
|
277 |
+
font-size: 1rem;
|
278 |
+
cursor: pointer;
|
279 |
+
border-radius: 5px;
|
280 |
+
padding: 10px 20px;
|
281 |
+
border: none;
|
282 |
+
transition: background-color 0.3s ease;
|
283 |
+
}
|
284 |
+
|
285 |
+
.next-button:hover {
|
286 |
+
background-color: #0277bd;
|
287 |
+
}
|
288 |
+
|
289 |
+
.next-button:active {
|
290 |
+
background-color: #01579b;
|
291 |
+
}
|
292 |
+
|
293 |
+
/* Styling for the instruction text */
|
294 |
+
#instruction {
|
295 |
+
font-size: 1.5rem;
|
296 |
+
margin-bottom: 10px;
|
297 |
+
text-align: center;
|
298 |
+
}
|
299 |
+
|
300 |
+
#topic {
|
301 |
+
font-size: 2rem;
|
302 |
+
margin-top: 10px;
|
303 |
+
text-align: center;
|
304 |
+
}
|
ice_breaking_challenge/templates/finish.html
CHANGED
@@ -1,7 +1,9 @@
|
|
1 |
{% extends 'base.html' %}
|
2 |
|
3 |
{% block content %}
|
4 |
-
|
5 |
-
<
|
6 |
-
<p
|
|
|
|
|
7 |
{% endblock %}
|
|
|
1 |
{% extends 'base.html' %}
|
2 |
|
3 |
{% block content %}
|
4 |
+
<div class="quiz-container">
|
5 |
+
<h1 id="topic">ํด์ฆ๊ฐ ๋๋ฌ์ต๋๋ค!</h1>
|
6 |
+
<p id="instruction">์ฆ๊ฑฐ์ฐ์
จ๋์? ๋ง์ด ์นํด์ง์
จ๋์?</p>
|
7 |
+
<p id="instruction">์ฐธ์ฌํด์ฃผ์
์ ๊ฐ์ฌํฉ๋๋ค. ์์ผ๋ก๋ ์ข์ ์๊ฐ ๋์ธ์!</p>
|
8 |
+
</div>
|
9 |
{% endblock %}
|
ice_breaking_challenge/templates/introduction.html
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
{% extends 'base.html' %}
|
2 |
|
3 |
{% block content %}
|
4 |
-
|
5 |
<h2 style="font-family: 'Montserrat', sans-serif; font-weight: 700; color: #2c3e50;">์๊ธฐ์๊ฐ ํ๋ ์๊ฐ์ ๊ฐ์ ธ ๋ณด์ธ์</h2>
|
6 |
<p style="font-family: 'Montserrat', sans-serif; color: #7f8c8d;">ํ์๋ค๊ณผ ํจ๊ป ๊ฐ๋จํ ์๊ธฐ์๊ฐ๋ฅผ ํด๋ณด์ธ์!</p>
|
7 |
<form method="post" style="margin-top: 20px;">
|
|
|
1 |
{% extends 'base.html' %}
|
2 |
|
3 |
{% block content %}
|
4 |
+
<div class="quiz-container" style="text-align: center; margin-top: 20px;">
|
5 |
<h2 style="font-family: 'Montserrat', sans-serif; font-weight: 700; color: #2c3e50;">์๊ธฐ์๊ฐ ํ๋ ์๊ฐ์ ๊ฐ์ ธ ๋ณด์ธ์</h2>
|
6 |
<p style="font-family: 'Montserrat', sans-serif; color: #7f8c8d;">ํ์๋ค๊ณผ ํจ๊ป ๊ฐ๋จํ ์๊ธฐ์๊ฐ๋ฅผ ํด๋ณด์ธ์!</p>
|
7 |
<form method="post" style="margin-top: 20px;">
|
ice_breaking_challenge/templates/quiz.html
CHANGED
@@ -1,33 +1,50 @@
|
|
1 |
{% extends 'base.html' %}
|
2 |
|
3 |
{% block content %}
|
4 |
-
<
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
19 |
<form method="post" style="margin-top: 20px;">
|
20 |
-
<input type="submit" value="
|
21 |
</form>
|
|
|
22 |
|
23 |
<script>
|
24 |
function showAnswer() {
|
25 |
-
const answer = document.getElementById(
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
answer.style.display = "none";
|
30 |
-
}
|
31 |
}
|
32 |
</script>
|
33 |
{% endblock %}
|
|
|
1 |
{% extends 'base.html' %}
|
2 |
|
3 |
{% block content %}
|
4 |
+
<div class="quiz-container">
|
5 |
+
<h1 class="quiz-title">Quiz Results</h1>
|
6 |
+
|
7 |
+
{% if quiz %}
|
8 |
+
<div class="quiz-content">
|
9 |
+
<!-- Display quiz host's name -->
|
10 |
+
<div class="quiz-host-container">
|
11 |
+
<span class="quiz-host">Host: {{ quiz[0] }}</span>
|
12 |
+
</div>
|
13 |
+
|
14 |
+
<!-- Display the question -->
|
15 |
+
<div class="quiz-question-container">
|
16 |
+
<span class="quiz-question">{{ quiz[1] }}</span>
|
17 |
+
</div>
|
18 |
+
|
19 |
+
<!-- Display quiz options as it is -->
|
20 |
+
<ul class="choices">
|
21 |
+
{% for choice in quiz[2] %}
|
22 |
+
<li>{{ loop.index }}. {{ choice }}</li>
|
23 |
+
{% endfor %}
|
24 |
+
</ul>
|
25 |
+
|
26 |
+
<!-- Show answer button that disappears after click -->
|
27 |
+
<button class="answer-button" onclick="showAnswer()">Show Answer</button>
|
28 |
+
|
29 |
+
<!-- Correct answer, initially hidden -->
|
30 |
+
<p id="answer" style="display: none;" class="correct-answer">Correct Answer: {{ quiz[3] }}</p>
|
31 |
+
</div>
|
32 |
+
{% else %}
|
33 |
+
<p>No quiz available. Please try again.</p>
|
34 |
+
{% endif %}
|
35 |
+
|
36 |
+
<!-- Button to move to the next quiz -->
|
37 |
<form method="post" style="margin-top: 20px;">
|
38 |
+
<input type="submit" value="Next" class="next-button">
|
39 |
</form>
|
40 |
+
</div>
|
41 |
|
42 |
<script>
|
43 |
function showAnswer() {
|
44 |
+
const answer = document.getElementById('answer');
|
45 |
+
const button = document.querySelector('.answer-button');
|
46 |
+
answer.style.display = "block";
|
47 |
+
button.style.display = "none"; // Hide the button after clicking
|
|
|
|
|
48 |
}
|
49 |
</script>
|
50 |
{% endblock %}
|
ice_breaking_challenge/templates/topic.html
CHANGED
@@ -1,8 +1,11 @@
|
|
1 |
{% extends 'base.html' %}
|
2 |
|
3 |
{% block content %}
|
4 |
-
|
|
|
5 |
|
|
|
|
|
6 |
<script>
|
7 |
// 20์ด๋ง๋ค ํ์ด์ง ์๋ก๊ณ ์นจ
|
8 |
setInterval(function() {
|
|
|
1 |
{% extends 'base.html' %}
|
2 |
|
3 |
{% block content %}
|
4 |
+
<div class="quiz-container">
|
5 |
+
<h1 id=>๋ค์์ ์ฃผ์ ๋ก ์๊ฐ์ ๊ณต์ ํด๋ณด์ธ์!</h1>
|
6 |
|
7 |
+
<p id="instruction" style="color: #262a2a;">{{ topic }}</p> <!-- ์๋ฒ์์ ์ ๋ฌํ ์ฃผ์ ๋ฅผ ๋ฐ๋ก ํ์ -->
|
8 |
+
</div>
|
9 |
<script>
|
10 |
// 20์ด๋ง๋ค ํ์ด์ง ์๋ก๊ณ ์นจ
|
11 |
setInterval(function() {
|