updates
Browse files- app.py +1 -1
- static/script.js +1 -0
app.py
CHANGED
@@ -70,10 +70,10 @@ def start_quiz():
|
|
70 |
current_question['started'] = True
|
71 |
index = current_question['index']
|
72 |
question = selected_questions[index]
|
|
|
73 |
emit('new_question', {"question": question["question"], "options": question["options"], "index": index + 1}, room='quiz')
|
74 |
emit('enable_end_quiz', room=request.sid) # Enable "End Quiz" for the host
|
75 |
|
76 |
-
|
77 |
@socketio.on('restart_quiz')
|
78 |
def restart_quiz():
|
79 |
reset_quiz()
|
|
|
70 |
current_question['started'] = True
|
71 |
index = current_question['index']
|
72 |
question = selected_questions[index]
|
73 |
+
# Send the starting question to all clients
|
74 |
emit('new_question', {"question": question["question"], "options": question["options"], "index": index + 1}, room='quiz')
|
75 |
emit('enable_end_quiz', room=request.sid) # Enable "End Quiz" for the host
|
76 |
|
|
|
77 |
@socketio.on('restart_quiz')
|
78 |
def restart_quiz():
|
79 |
reset_quiz()
|
static/script.js
CHANGED
@@ -103,6 +103,7 @@ socket.on('new_question', (data) => {
|
|
103 |
|
104 |
|
105 |
|
|
|
106 |
socket.on('display_results', (data) => {
|
107 |
const img = `<img src="data:image/png;base64,${data.chart}" alt="Results Chart" />`;
|
108 |
const resultText = `<p>Correct Answer: ${data.results.correct_answer}</p>`;
|
|
|
103 |
|
104 |
|
105 |
|
106 |
+
|
107 |
socket.on('display_results', (data) => {
|
108 |
const img = `<img src="data:image/png;base64,${data.chart}" alt="Results Chart" />`;
|
109 |
const resultText = `<p>Correct Answer: ${data.results.correct_answer}</p>`;
|