ruslanmv commited on
Commit
489b3c4
1 Parent(s): d72d0a0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +0 -27
app.py CHANGED
@@ -10,7 +10,6 @@ from io import BytesIO
10
  import random
11
  import logging
12
 
13
-
14
  # Configure the logging level
15
  logging.getLogger('eventlet.wsgi.server').setLevel(logging.ERROR)
16
  app = Flask(__name__)
@@ -61,22 +60,10 @@ def load_quiz(data):
61
  if selected_questions:
62
  num_questions = len(selected_questions)
63
  current_question['index'] = start_question # Set the starting question index
64
- #emit('quiz_loaded', {"success": True, "num_questions": num_questions}, room=request.sid)
65
  emit('quiz_loaded', {"success": True, "num_questions": num_questions, "start_question": start_question + 1}, room=request.sid)
66
-
67
  else:
68
  emit('quiz_loaded', {"success": False}, room=request.sid)
69
 
70
- #@socketio.on('start_quiz')
71
- #def start_quiz():
72
- # if participants and selected_questions:
73
- # current_question['started'] = True
74
- # index = current_question['index']
75
- # emit('new_question', selected_questions[index], room='quiz')
76
- # # Also emit the question to the host
77
- # emit('new_question', selected_questions[index], room=request.sid)
78
- # emit('enable_end_quiz', room=request.sid) # Enable "End Quiz" for the host
79
-
80
  @socketio.on('start_quiz')
81
  def start_quiz():
82
  if participants and selected_questions:
@@ -119,20 +106,6 @@ def check_answers():
119
  if current_question['answers'].get(participant["username"]) == correct_answer:
120
  participants[sid]["score"] += 1
121
 
122
- #@socketio.on('next_question')
123
- #def next_question():
124
- # current_question['index'] += 1
125
- # current_question['answers'] = {}
126
- # if current_question['index'] < len(selected_questions):
127
- # question = selected_questions[current_question['index']]
128
- # emit('clear_results', room='quiz')
129
- # emit('new_question', question, room='quiz')
130
- # # Also emit the question to the host
131
- # emit('new_question', question, room=request.sid)
132
- # else:
133
- # final_results = calculate_final_results()
134
- # emit('display_final_results', final_results, room='quiz')
135
-
136
  @socketio.on('next_question')
137
  def next_question():
138
  current_question['index'] += 1
 
10
  import random
11
  import logging
12
 
 
13
  # Configure the logging level
14
  logging.getLogger('eventlet.wsgi.server').setLevel(logging.ERROR)
15
  app = Flask(__name__)
 
60
  if selected_questions:
61
  num_questions = len(selected_questions)
62
  current_question['index'] = start_question # Set the starting question index
 
63
  emit('quiz_loaded', {"success": True, "num_questions": num_questions, "start_question": start_question + 1}, room=request.sid)
 
64
  else:
65
  emit('quiz_loaded', {"success": False}, room=request.sid)
66
 
 
 
 
 
 
 
 
 
 
 
67
  @socketio.on('start_quiz')
68
  def start_quiz():
69
  if participants and selected_questions:
 
106
  if current_question['answers'].get(participant["username"]) == correct_answer:
107
  participants[sid]["score"] += 1
108
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
109
  @socketio.on('next_question')
110
  def next_question():
111
  current_question['index'] += 1