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

This commit is contained in:
lubukhu
2026-01-24 14:18:08 +07:00
parent 88cff1109c
commit 259a24bff3

View File

@@ -261,6 +261,19 @@ var tdv_sdk = {
this.currentQuestion = this.list[this.level];
if (this.currentQuestion) {
// ===== NORMALIZE DATA FROM SDK IFRAME =====
if (this.currentQuestion.content && !this.currentQuestion.sentence) {
this.currentQuestion.sentence = this.currentQuestion.content;
}
if (Array.isArray(this.currentQuestion.options) && !this.currentQuestion.parts) {
this.currentQuestion.parts = this.currentQuestion.options;
}
// Fallback cuối: nếu vẫn chưa có parts
if (!this.currentQuestion.parts && this.currentQuestion.sentence) {
this.currentQuestion.parts = this.currentQuestion.sentence.split(/\s+/);
}
// Lấy câu đúng từ field "sentence"
this.correctSentence = String(this.currentQuestion.sentence || "").trim();