Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -1395,11 +1395,21 @@ def create_game(host=None, topics=[], num_questions=5, auto_close=True, ai_topic
|
|
| 1395 |
for topic in topics:
|
| 1396 |
qs = questions_db.get(topic, [])
|
| 1397 |
for q in qs[:num_questions]:
|
| 1398 |
-
|
| 1399 |
-
|
| 1400 |
-
|
| 1401 |
-
|
| 1402 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1403 |
|
| 1404 |
# 🔹 STORE GAME
|
| 1405 |
games[gid] = {
|
|
|
|
| 1395 |
for topic in topics:
|
| 1396 |
qs = questions_db.get(topic, [])
|
| 1397 |
for q in qs[:num_questions]:
|
| 1398 |
+
# ✅ NEW FORMAT (dict)
|
| 1399 |
+
if isinstance(q, dict):
|
| 1400 |
+
questions.append({
|
| 1401 |
+
"question": q.get("question", ""),
|
| 1402 |
+
"options": q.get("options", []),
|
| 1403 |
+
"answer": q.get("answer", "")
|
| 1404 |
+
})
|
| 1405 |
+
|
| 1406 |
+
# ✅ OLD FORMAT (tuple)
|
| 1407 |
+
else:
|
| 1408 |
+
questions.append({
|
| 1409 |
+
"question": q[0],
|
| 1410 |
+
"options": q[1],
|
| 1411 |
+
"answer": q[2]
|
| 1412 |
+
})
|
| 1413 |
|
| 1414 |
# 🔹 STORE GAME
|
| 1415 |
games[gid] = {
|