dongwook-chan commited on
Commit
0863930
โ€ข
1 Parent(s): a40292e
ice_breaking_challenge/background_task.py CHANGED
@@ -25,20 +25,27 @@ def background_task(sid, qna: pd.DataFrame, team_size: int):
25
 
26
 
27
  def sample_quizzes(data: pd.DataFrame, team_size: int):
28
- questions_size = min(10 // team_size + 1, 5)
29
  sample_indices: dict[str, list[str]] = dict()
30
  for row in data.itertuples():
31
  sample_indices[row.Index] = random.sample(['Q1', 'Q2', 'Q3', 'Q4', 'Q5'], questions_size)
32
 
33
- sample_quizzes = []
 
34
  for key, value in sample_indices.items():
35
- for question_number in value:
 
 
 
 
 
36
  question = QUESTIONS.iloc[0][question_number]
37
  answer = data.iloc[key][question_number]
38
  name = data.iloc[key]['name']
39
- sample_quizzes.append([question, answer, name])
40
 
41
- return sample_quizzes[:2] # TODO
 
42
 
43
 
44
  def generate_quiz(data: pd.DataFrame, team_size: int):
 
25
 
26
 
27
  def sample_quizzes(data: pd.DataFrame, team_size: int):
28
+ questions_size = min(10 // team_size + (1 if 10 % team_size else 0), 5)
29
  sample_indices: dict[str, list[str]] = dict()
30
  for row in data.itertuples():
31
  sample_indices[row.Index] = random.sample(['Q1', 'Q2', 'Q3', 'Q4', 'Q5'], questions_size)
32
 
33
+ mandatory_quizzes = []
34
+ option_quizzes = []
35
  for key, value in sample_indices.items():
36
+ question_number = value[0]
37
+ question = QUESTIONS.iloc[0][question_number]
38
+ answer = data.iloc[key][question_number]
39
+ name = data.iloc[key]['name']
40
+ mandatory_quizzes.append([question, answer, name])
41
+ for question_number in value[1:]:
42
  question = QUESTIONS.iloc[0][question_number]
43
  answer = data.iloc[key][question_number]
44
  name = data.iloc[key]['name']
45
+ option_quizzes.append([question, answer, name])
46
 
47
+ random.shuffle(option_quizzes)
48
+ return (mandatory_quizzes + option_quizzes)[:10] # TODO
49
 
50
 
51
  def generate_quiz(data: pd.DataFrame, team_size: int):
ice_breaking_challenge/quiz.py CHANGED
@@ -14,7 +14,7 @@ def quiz():
14
  else:
15
  session['question_number'] += 1
16
 
17
- if session['question_number'] == 2: # TODO:
18
  return redirect(url_for("quiz.finish"))
19
 
20
  print(session['question_number'])
 
14
  else:
15
  session['question_number'] += 1
16
 
17
+ if session['question_number'] == 10: # TODO:
18
  return redirect(url_for("quiz.finish"))
19
 
20
  print(session['question_number'])
ice_breaking_challenge/static/character.png ADDED
ice_breaking_challenge/static/style.css CHANGED
@@ -302,3 +302,8 @@ input[type=submit]:active {
302
  margin-top: 10px;
303
  text-align: center;
304
  }
 
 
 
 
 
 
302
  margin-top: 10px;
303
  text-align: center;
304
  }
305
+
306
+ .character-container {
307
+ flex-shrink: 0; /* Prevents shrinking of the image container */
308
+ text-align: right; /* Align the image to the right */
309
+ }
ice_breaking_challenge/templates/introduction.html CHANGED
@@ -4,10 +4,14 @@
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;">
8
  <input type="submit" value="๋‹ค์Œ" style="padding: 10px 20px; font-size: 16px; cursor: pointer; border-radius: 5px; border: none; background-color: #2980b9; color: white;">
9
  </form>
10
  </div>
 
 
 
11
  <!-- Google Fonts ์ถ”๊ฐ€ -->
12
  <link href="https://fonts.googleapis.com/css2?family=Montserrat:wght@400;700&display=swap" rel="stylesheet">
13
  {% endblock %}
 
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
+
8
  <form method="post" style="margin-top: 20px;">
9
  <input type="submit" value="๋‹ค์Œ" style="padding: 10px 20px; font-size: 16px; cursor: pointer; border-radius: 5px; border: none; background-color: #2980b9; color: white;">
10
  </form>
11
  </div>
12
+ <div class="character-container" style="margin-top: 30px; text-align: right;">
13
+ <img src="{{ url_for('static', filename='character.png') }}" alt="character" width="200">
14
+ </div>
15
  <!-- Google Fonts ์ถ”๊ฐ€ -->
16
  <link href="https://fonts.googleapis.com/css2?family=Montserrat:wght@400;700&display=swap" rel="stylesheet">
17
  {% endblock %}
ice_breaking_challenge/templates/topic.html CHANGED
@@ -5,7 +5,12 @@
5
  <h1 id=>๋‹ค์Œ์„ ์ฃผ์ œ๋กœ ์ƒ๊ฐ์„ ๊ณต์œ ํ•ด๋ณด์„ธ์š”!</h1>
6
 
7
  <p id="instruction" style="color: #262a2a;">{{ topic }}</p> <!-- ์„œ๋ฒ„์—์„œ ์ „๋‹ฌํ•œ ์ฃผ์ œ๋ฅผ ๋ฐ”๋กœ ํ‘œ์‹œ -->
 
 
8
  </div>
 
 
 
9
  <script>
10
  // 20์ดˆ๋งˆ๋‹ค ํŽ˜์ด์ง€ ์ƒˆ๋กœ๊ณ ์นจ
11
  setInterval(function() {
 
5
  <h1 id=>๋‹ค์Œ์„ ์ฃผ์ œ๋กœ ์ƒ๊ฐ์„ ๊ณต์œ ํ•ด๋ณด์„ธ์š”!</h1>
6
 
7
  <p id="instruction" style="color: #262a2a;">{{ topic }}</p> <!-- ์„œ๋ฒ„์—์„œ ์ „๋‹ฌํ•œ ์ฃผ์ œ๋ฅผ ๋ฐ”๋กœ ํ‘œ์‹œ -->
8
+
9
+ <br>
10
  </div>
11
+ <div class="character-container" style="margin-top: 30px; text-align: right;">
12
+ <img src="{{ url_for('static', filename='character.png') }}" alt="character" width="200">
13
+ </div>
14
  <script>
15
  // 20์ดˆ๋งˆ๋‹ค ํŽ˜์ด์ง€ ์ƒˆ๋กœ๊ณ ์นจ
16
  setInterval(function() {