Spaces:
Runtime error
Runtime error
Commit
โข
aecb384
1
Parent(s):
a40292e
pr #7 (#7)
Browse files- Update (08639308a0fb993ace9b475cf0dbf7932d87357b)
- Update (d3bd760cf8e5a6dea636613545d72dd9c183d6ca)
Co-authored-by: Dongwook Chang <[email protected]>
- Dockerfile +2 -0
- ice_breaking_challenge/background_task.py +12 -5
- ice_breaking_challenge/quiz.py +1 -1
- ice_breaking_challenge/static/character.png +0 -0
- ice_breaking_challenge/static/style.css +5 -0
- ice_breaking_challenge/templates/introduction.html +4 -0
- ice_breaking_challenge/templates/topic.html +5 -0
Dockerfile
CHANGED
@@ -16,6 +16,8 @@ RUN mkdir -p /.cache && chmod -R 777 /.cache
|
|
16 |
# Create the flask_session directory and set the appropriate permissions
|
17 |
RUN mkdir -p /app/flask_session && chmod 777 /app/flask_session
|
18 |
|
|
|
|
|
19 |
# Install any needed packages specified in requirements.txt
|
20 |
RUN pip install --no-cache-dir -r requirements.txt
|
21 |
|
|
|
16 |
# Create the flask_session directory and set the appropriate permissions
|
17 |
RUN mkdir -p /app/flask_session && chmod 777 /app/flask_session
|
18 |
|
19 |
+
RUN chmod -R 777 token.json
|
20 |
+
|
21 |
# Install any needed packages specified in requirements.txt
|
22 |
RUN pip install --no-cache-dir -r requirements.txt
|
23 |
|
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 |
-
|
|
|
34 |
for key, value in sample_indices.items():
|
35 |
-
|
|
|
|
|
|
|
|
|
|
|
36 |
question = QUESTIONS.iloc[0][question_number]
|
37 |
answer = data.iloc[key][question_number]
|
38 |
name = data.iloc[key]['name']
|
39 |
-
|
40 |
|
41 |
-
|
|
|
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'] ==
|
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() {
|