matsuap commited on
Commit
07e7924
·
verified ·
1 Parent(s): e4341db

Upload workbook_server.py

Browse files
Files changed (1) hide show
  1. workbook_server.py +3 -2
workbook_server.py CHANGED
@@ -54,7 +54,7 @@ class ChapterRequest(BaseModel):
54
  def get_questions_by_chapter(request: ChapterRequest):
55
  db = get_db()
56
  cursor = db.cursor()
57
- cursor.execute("SELECT question, options, answer, explain FROM question WHERE chapter = ? AND kind = '正誤問題'", (request.chapter_number,))
58
  questions = cursor.fetchall()
59
  if not questions:
60
  raise HTTPException(status_code=404, detail="Questions not found for the given chapter number")
@@ -63,7 +63,8 @@ def get_questions_by_chapter(request: ChapterRequest):
63
  "question_text": row[0],
64
  "options": row[1],
65
  "answer": row[2],
66
- "explanation": row[3]
 
67
  } for row in questions
68
  ]
69
  return JSONResponse(content=question_list)
 
54
  def get_questions_by_chapter(request: ChapterRequest):
55
  db = get_db()
56
  cursor = db.cursor()
57
+ cursor.execute("SELECT question, options, answer, explain, image FROM question WHERE chapter = ? AND kind = '正誤問題'", (request.chapter_number,))
58
  questions = cursor.fetchall()
59
  if not questions:
60
  raise HTTPException(status_code=404, detail="Questions not found for the given chapter number")
 
63
  "question_text": row[0],
64
  "options": row[1],
65
  "answer": row[2],
66
+ "explanation": row[3],
67
+ "image": row[4],
68
  } for row in questions
69
  ]
70
  return JSONResponse(content=question_list)