This commit is contained in:
@@ -253,32 +253,23 @@ var tdv_sdk = {
|
|||||||
// ==================== LOGIC CHÍNH: LOAD CÂU HỎI ====================
|
// ==================== LOGIC CHÍNH: LOAD CÂU HỎI ====================
|
||||||
lastLoadedLevel: -1,
|
lastLoadedLevel: -1,
|
||||||
|
|
||||||
loadQuestions: function () {
|
loadQuestion: 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];
|
||||||
if (this.currentQuestion) {
|
if (!this.currentQuestion) return;
|
||||||
// ===== NORMALIZE DATA (COMPANY STANDARD) =====
|
|
||||||
var q = this.currentQuestion;
|
|
||||||
|
|
||||||
// Chuẩn công ty
|
this.questionStartTime = new Date();
|
||||||
if (q.question && !q.sentence) {
|
this.waitingForServerVerify = false;
|
||||||
q.sentence = q.question;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Options / words
|
// Normalize question array
|
||||||
if (Array.isArray(q.options) && !q.parts) {
|
this.sequence.originalQuestion =
|
||||||
q.parts = q.options;
|
JSON.parse(JSON.stringify(this.currentQuestion.question || []));
|
||||||
}
|
this.sequence.userSequence =
|
||||||
|
JSON.parse(JSON.stringify(this.sequence.originalQuestion));
|
||||||
|
|
||||||
// Fallback cuối
|
this.sequence.isCompleted = false;
|
||||||
if (!q.parts && q.sentence) {
|
|
||||||
q.parts = q.sentence.split(/\s+/);
|
window.answerResult = -1;
|
||||||
}
|
window.gameState = 0;
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
// Tính width dựa trên số từ và độ dài từ dài nhất
|
// Tính width dựa trên số từ và độ dài từ dài nhất
|
||||||
|
|||||||
Reference in New Issue
Block a user