matsuap commited on
Commit
c9dfe5e
·
verified ·
1 Parent(s): 5a41f5d

Upload workbook_server.py

Browse files
Files changed (1) hide show
  1. workbook_server.py +3 -4
workbook_server.py CHANGED
@@ -37,7 +37,7 @@ class ChapterRequest(BaseModel):
37
  def get_questions_by_chapter(request: ChapterRequest):
38
  db = get_db()
39
  cursor = db.cursor()
40
- cursor.execute("SELECT question, options, answer, explain, '正誤判定' as kind FROM question WHERE chapter = ?", (request.chapter_number,))
41
  questions = cursor.fetchall()
42
  if not questions:
43
  raise HTTPException(status_code=404, detail="Questions not found for the given chapter number")
@@ -45,9 +45,8 @@ def get_questions_by_chapter(request: ChapterRequest):
45
  {
46
  "question_text": row[0],
47
  "options": row[1],
48
- "kind": row[2],
49
- "answer": row[3],
50
- "explanation": row[4]
51
  } for row in questions
52
  ]
53
  return JSONResponse(content=question_list)
 
37
  def get_questions_by_chapter(request: ChapterRequest):
38
  db = get_db()
39
  cursor = db.cursor()
40
+ cursor.execute("SELECT question, options, answer, explain FROM question WHERE chapter = ? AND kind = '正誤問題'", (request.chapter_number,))
41
  questions = cursor.fetchall()
42
  if not questions:
43
  raise HTTPException(status_code=404, detail="Questions not found for the given chapter number")
 
45
  {
46
  "question_text": row[0],
47
  "options": row[1],
48
+ "answer": row[2],
49
+ "explanation": row[3]
 
50
  } for row in questions
51
  ]
52
  return JSONResponse(content=question_list)