TOMOCHIN4 Claude Opus 4.5 commited on
Commit
3f841bc
·
1 Parent(s): 08c9914

debug: SCORE 0/0問題のデバッグロギング追加 (v1.6.12)

Browse files

- gas/Code.js: handleSubmitAnswers レスポンスログ
- app.py: submit_answers GASレスポンスログ
- apiClient.js: submitAnswers API戻り値ログ
- components.js: ResultScreen submitResult ログ

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

Files changed (5) hide show
  1. app.py +1 -0
  2. gas/Code.js +11 -1
  3. log/LOG.md +60 -1
  4. static/js/apiClient.js +6 -1
  5. static/js/components.js +4 -0
app.py CHANGED
@@ -405,6 +405,7 @@ async def submit_answers(request: SubmitAnswersRequest):
405
  session_id=request.session_id,
406
  answers=[a.model_dump() for a in request.answers]
407
  )
 
408
  return result
409
  except Exception as e:
410
  logger.error(f"submit_answers error: {e}")
 
405
  session_id=request.session_id,
406
  answers=[a.model_dump() for a in request.answers]
407
  )
408
+ logger.info(f"[submit_answers] GAS response: {result}")
409
  return result
410
  except Exception as e:
411
  logger.error(f"submit_answers error: {e}")
gas/Code.js CHANGED
@@ -1,10 +1,11 @@
1
  /**
2
  * 超天才クイズAPI - Google Apps Script メインファイル
3
  *
4
- * @version 1.6.11
5
  * @date 2025-12-20
6
  *
7
  * 変更履歴:
 
8
  * - v1.6.11: handleSubmitAnswers レスポンスキー修正 (correct_count→correct, total_questions→total, score→accuracy)
9
  * - v1.6.10: getSessionResults カラムインデックス修正 (row[5],row[7],row[8])
10
  * - v1.6.9: correct_answer 0-indexed統一, temperature=1.0
@@ -737,6 +738,15 @@ function handleSubmitAnswers(params) {
737
  updateUserStats(userId, 1, totalCount);
738
  }
739
 
 
 
 
 
 
 
 
 
 
740
  return createJsonResponse({
741
  success: true,
742
  data: {
 
1
  /**
2
  * 超天才クイズAPI - Google Apps Script メインファイル
3
  *
4
+ * @version 1.6.12
5
  * @date 2025-12-20
6
  *
7
  * 変更履歴:
8
+ * - v1.6.12: デバッグロギング追加
9
  * - v1.6.11: handleSubmitAnswers レスポンスキー修正 (correct_count→correct, total_questions→total, score→accuracy)
10
  * - v1.6.10: getSessionResults カラムインデックス修正 (row[5],row[7],row[8])
11
  * - v1.6.9: correct_answer 0-indexed統一, temperature=1.0
 
738
  updateUserStats(userId, 1, totalCount);
739
  }
740
 
741
+ // デバッグログ (v1.6.12)
742
+ console.log('[handleSubmitAnswers] Response data:', JSON.stringify({
743
+ session_id: sessionId,
744
+ total: totalCount,
745
+ correct: correctCount,
746
+ accuracy: score,
747
+ answers_saved: answers.length
748
+ }));
749
+
750
  return createJsonResponse({
751
  success: true,
752
  data: {
log/LOG.md CHANGED
@@ -1,5 +1,64 @@
1
  # 開発ログ
2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  ## v1.6.9 correct_answer 0-indexed統一・temperature統一
4
 
5
  ### 2025-12-20 01:15 - handleSubmitAnswers レスポンスキー修正 ✅
@@ -186,4 +245,4 @@ Gemini の **Structured Output** 機能を使用し、`response_json_schema` パ
186
  - 2025-12-17 QuestionDB駆動問題生成 実装完了
187
 
188
  ---
189
- **最終更新**: 2025-12-20 01:00
 
1
  # 開発ログ
2
 
3
+ ## v1.6.11 SCORE 0/0問題修正
4
+
5
+ ### 2025-12-20 14:45 - ResultScreen デバッグログ追加 ✅
6
+
7
+ #### 実施作業
8
+ - static/js/components.js ResultScreen コンポーネント(663行付近)にデバッグログ追加
9
+ - submitResult 取得後、setResult 呼び出し前に以下を追加:
10
+ - console.log('[ResultScreen] submitResult:', submitResult);
11
+ - console.log('[ResultScreen] submitResult.data:', submitResult?.data);
12
+ - console.log('[ResultScreen] correct:', submitResult?.data?.correct, 'total:', submitResult?.data?.total);
13
+
14
+ #### 目的
15
+ - submitResult の全体構造確認
16
+ - submitResult.data の内容確認
17
+ - correct と total の値確認
18
+
19
+ #### ステータス
20
+ - ✅ デバッグログ追加完了
21
+ - 🔲 git commit待ち
22
+
23
+ #### 次回開始時の指針
24
+ - git commit後にHF Spaces反映
25
+ - E2Eテストでコンソールログ確認
26
+
27
+ ---
28
+
29
+ ### 2025-12-20 02:30 - v1.6.11 SCORE 0/0問題修正 ✅
30
+
31
+ #### 実施作業
32
+ - gas/Code.js handleSubmitAnswers レスポンスキー修正
33
+ - correct_count → correct
34
+ - total_questions → total
35
+ - score → accuracy
36
+ - バージョンヘッダー更新 (v1.6.11)
37
+ - clasp push (8 files)
38
+ - git commit & push (08c9914)
39
+
40
+ #### 根本原因
41
+ GASレスポンスキーとフロントエンド期待値の不一致
42
+ - GAS: correct_count, total_questions, score
43
+ - Frontend: correct, total, accuracy
44
+
45
+ #### ステータス
46
+ - ✅ コード修正完了
47
+ - ✅ clasp push完了
48
+ - ✅ git push完了
49
+ - 🔲 GAS再デプロイ待ち (@40)
50
+ - 🔲 E2Eテスト検証待ち
51
+
52
+ #### コミット情報
53
+ - コミットID: 08c9914
54
+ - ロールバック: git revert 08c9914
55
+
56
+ #### 次回開始時の指針
57
+ - GAS再デプロイ後にE2Eテスト実行
58
+ - SCOREが正しく表示されるか確認
59
+
60
+ ---
61
+
62
  ## v1.6.9 correct_answer 0-indexed統一・temperature統一
63
 
64
  ### 2025-12-20 01:15 - handleSubmitAnswers レスポンスキー修正 ✅
 
245
  - 2025-12-17 QuestionDB駆動問題生成 実装完了
246
 
247
  ---
248
+ **最終更新**: 2025-12-20 02:30
static/js/apiClient.js CHANGED
@@ -210,11 +210,16 @@ const ApiClient = {
210
  };
211
  });
212
 
213
- return await this._callApi(
214
  '/api/submit_answers',
215
  { session_id: sessionId, answers: formattedAnswers },
216
  'submitAnswers'
217
  );
 
 
 
 
 
218
  },
219
 
220
  /**
 
210
  };
211
  });
212
 
213
+ const result = await this._callApi(
214
  '/api/submit_answers',
215
  { session_id: sessionId, answers: formattedAnswers },
216
  'submitAnswers'
217
  );
218
+
219
+ console.log('[apiClient.submitAnswers] API response:', result);
220
+ console.log('[apiClient.submitAnswers] result.data:', result?.data);
221
+
222
+ return result;
223
  },
224
 
225
  /**
static/js/components.js CHANGED
@@ -669,6 +669,10 @@ const ResultScreen = ({ onReset }) => {
669
  return;
670
  }
671
 
 
 
 
 
672
  setResult(submitResult.data);
673
 
674
  // ステップ2: 統計計算
 
669
  return;
670
  }
671
 
672
+ console.log('[ResultScreen] submitResult:', submitResult);
673
+ console.log('[ResultScreen] submitResult.data:', submitResult?.data);
674
+ console.log('[ResultScreen] correct:', submitResult?.data?.correct, 'total:', submitResult?.data?.total);
675
+
676
  setResult(submitResult.data);
677
 
678
  // ステップ2: 統計計算