From 08e6fbe612e6babc9750da0072096ba63f674f96 Mon Sep 17 00:00:00 2001 From: lubukhu <150521080+lubukhu@users.noreply.github.com> Date: Sat, 24 Jan 2026 14:30:15 +0700 Subject: [PATCH] up --- G102-sequence/tdv_sdk.js | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/G102-sequence/tdv_sdk.js b/G102-sequence/tdv_sdk.js index e53c497..77229e3 100644 --- a/G102-sequence/tdv_sdk.js +++ b/G102-sequence/tdv_sdk.js @@ -254,13 +254,30 @@ var tdv_sdk = { lastLoadedLevel: -1, loadQuestions: function () { + if (this.lastLoadedLevel === this.level && this.currentWords.length > 0) { + console.log("⏭️ Sentence", this.level + 1, "already loaded, skipping..."); + return; + } + this.currentQuestion = this.list[this.level]; - this.questionStartTime = new Date(); - window.gameState = 0; - window.answerResult = -1; if (this.currentQuestion) { - if (!this.currentQuestion.id) this.currentQuestion.id = "Q" + (this.level + 1); - console.log(`📝 Loaded Q${this.level + 1}: ${this.currentQuestion.question}`); + // ===== NORMALIZE DATA (COMPANY STANDARD) ===== + var q = this.currentQuestion; + + // Chuẩn công ty + if (q.question && !q.sentence) { + q.sentence = q.question; + } + + // Options / words + if (Array.isArray(q.options) && !q.parts) { + q.parts = q.options; + } + + // Fallback cuối + if (!q.parts && q.sentence) { + q.parts = q.sentence.split(/\s+/); + } } },