This commit is contained in:
@@ -254,13 +254,30 @@ var tdv_sdk = {
|
|||||||
lastLoadedLevel: -1,
|
lastLoadedLevel: -1,
|
||||||
|
|
||||||
loadQuestions: function () {
|
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.currentQuestion = this.list[this.level];
|
||||||
this.questionStartTime = new Date();
|
|
||||||
window.gameState = 0;
|
|
||||||
window.answerResult = -1;
|
|
||||||
if (this.currentQuestion) {
|
if (this.currentQuestion) {
|
||||||
if (!this.currentQuestion.id) this.currentQuestion.id = "Q" + (this.level + 1);
|
// ===== NORMALIZE DATA (COMPANY STANDARD) =====
|
||||||
console.log(`📝 Loaded Q${this.level + 1}: ${this.currentQuestion.question}`);
|
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+/);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user