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

This commit is contained in:
lubukhu
2026-01-24 14:30:15 +07:00
parent c5e587f1e5
commit 08e6fbe612

View File

@@ -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+/);
}
}
},