dongwook-chan commited on
Commit
775db6c
โ€ข
1 Parent(s): 8241e7f
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
- multiple_choice_generated = lines[1]
 
 
 
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 request, redirect, url_for
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
- <h1>ํ€ด์ฆˆ๊ฐ€ ๋๋‚ฌ์Šต๋‹ˆ๋‹ค!</h1>
5
- <p>์ฆ๊ฑฐ์šฐ์…จ๋‚˜์š”? ๋งŽ์ด ์นœํ•ด์ง€์…จ๋‚˜์š”? ๊ฐ์‚ฌํ•ฉ๋‹ˆ๋‹ค!</p>
6
- <p>์ฐธ์—ฌํ•ด์ฃผ์…”์„œ ๊ฐ์‚ฌํ•ฉ๋‹ˆ๋‹ค. ์•ž์œผ๋กœ๋„ ์ข‹์€ ์‹œ๊ฐ„ ๋˜์„ธ์š”!</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
- <div 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;">
 
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
- <h1>ํ€ด์ฆˆ ์ƒ์„ฑ ๊ฒฐ๊ณผ</h1>
5
-
6
- {% if quiz %}
7
- <ul>
8
- <h2>๋ฌธ์ œ ์ฃผ์ธ: {{ quiz[0] }}</h2> <!-- ์ด๋ฆ„ ๋ถ€๋ถ„ -->
9
- <h3>์งˆ๋ฌธ: {{ quiz[1] }}</h3> <!-- ์งˆ๋ฌธ ๋ถ€๋ถ„ -->
10
- <ul>
11
- {{ quiz[2] }} <!-- 4์ง€์„ ๋‹ค ๋ณด๊ธฐ -->
12
- </ul>
13
- <button onclick="showAnswer()">์ •๋‹ต ๋ณด๊ธฐ</button>
14
- <p id="answer" style="display: none;">์ •๋‹ต: {{ quiz[3] }}</p> <!-- ์ •๋‹ต -->
15
- </ul>
16
- {% else %}
17
- <p>ํ€ด์ฆˆ๊ฐ€ ์—†์Šต๋‹ˆ๋‹ค. ๋‹ค์‹œ ์‹œ๋„ํ•ด ์ฃผ์„ธ์š”.</p>
18
- {% endif %}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19
  <form method="post" style="margin-top: 20px;">
20
- <input type="submit" value="๋‹ค์Œ" style="padding: 10px 20px; font-size: 16px; cursor: pointer; border-radius: 5px; border: none; background-color: #2980b9; color: white;">
21
  </form>
 
22
 
23
  <script>
24
  function showAnswer() {
25
- const answer = document.getElementById(`answer`);
26
- if (answer.style.display === "none") {
27
- answer.style.display = "block";
28
- } else {
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
- <h1 id="topic">{{ topic }}</h1> <!-- ์„œ๋ฒ„์—์„œ ์ „๋‹ฌํ•œ ์ฃผ์ œ๋ฅผ ๋ฐ”๋กœ ํ‘œ์‹œ -->
 
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() {