From 05547ef4b8a81f80e027ecbc197c54d8f36640ff Mon Sep 17 00:00:00 2001 From: lubukhu <150521080+lubukhu@users.noreply.github.com> Date: Sat, 24 Jan 2026 14:32:16 +0700 Subject: [PATCH] up --- G102-sequence/tdv_sdk.js | 35 +++++++++++++---------------------- 1 file changed, 13 insertions(+), 22 deletions(-) diff --git a/G102-sequence/tdv_sdk.js b/G102-sequence/tdv_sdk.js index 77229e3..6dfa8f1 100644 --- a/G102-sequence/tdv_sdk.js +++ b/G102-sequence/tdv_sdk.js @@ -253,32 +253,23 @@ var tdv_sdk = { // ==================== LOGIC CHÍNH: LOAD CÂU HỎI ==================== lastLoadedLevel: -1, - loadQuestions: function () { - if (this.lastLoadedLevel === this.level && this.currentWords.length > 0) { - console.log("⏭️ Sentence", this.level + 1, "already loaded, skipping..."); - return; - } - + loadQuestion: function () { this.currentQuestion = this.list[this.level]; - if (this.currentQuestion) { - // ===== NORMALIZE DATA (COMPANY STANDARD) ===== - var q = this.currentQuestion; + if (!this.currentQuestion) return; - // Chuẩn công ty - if (q.question && !q.sentence) { - q.sentence = q.question; - } + this.questionStartTime = new Date(); + this.waitingForServerVerify = false; - // Options / words - if (Array.isArray(q.options) && !q.parts) { - q.parts = q.options; - } + // Normalize question array + this.sequence.originalQuestion = + JSON.parse(JSON.stringify(this.currentQuestion.question || [])); + this.sequence.userSequence = + JSON.parse(JSON.stringify(this.sequence.originalQuestion)); - // Fallback cuối - if (!q.parts && q.sentence) { - q.parts = q.sentence.split(/\s+/); - } - } + this.sequence.isCompleted = false; + + window.answerResult = -1; + window.gameState = 0; }, // Tính width dựa trên số từ và độ dài từ dài nhất