up
All checks were successful
Deploy to Production / deploy (push) Successful in 9s

This commit is contained in:
lubukhu
2026-01-24 14:32:16 +07:00
parent 08e6fbe612
commit 05547ef4b8

View File

@@ -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