ruslanmv commited on
Commit
91f4d25
1 Parent(s): c470530

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -8
app.py CHANGED
@@ -68,14 +68,11 @@ def load_quiz(data):
68
  def start_quiz():
69
  if participants and selected_questions:
70
  current_question['started'] = True
71
- index = current_question['index'] # Use the selected starting question index
72
- if index < len(selected_questions): # Ensure index is within bounds
73
- question = selected_questions[index]
74
- # Send the starting question to all clients
75
- emit('new_question', {"question": question["question"], "options": question["options"], "index": index + 1}, room='quiz')
76
- emit('enable_end_quiz', room=request.sid) # Enable "End Quiz" for the host
77
- else:
78
- emit('error', {"message": "Starting question exceeds available questions."}, room=request.sid)
79
 
80
  @socketio.on('restart_quiz')
81
  def restart_quiz():
 
68
  def start_quiz():
69
  if participants and selected_questions:
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():