commit
dd5a5fc1e2
|
@ -570,10 +570,15 @@ export class AddonModLessonPlayerPage implements OnInit, OnDestroy {
|
||||||
// Button to continue.
|
// Button to continue.
|
||||||
if (this.lesson.review && !result.correctanswer && !result.noanswer && !result.isessayquestion &&
|
if (this.lesson.review && !result.correctanswer && !result.noanswer && !result.isessayquestion &&
|
||||||
!result.maxattemptsreached) {
|
!result.maxattemptsreached) {
|
||||||
|
/* If both the "Yes, I'd like to try again" and "No, I just want to go on to the next question" point to the
|
||||||
|
same page then don't show the "No, I just want to go on to the next question" button. It's confusing. */
|
||||||
|
if (this.pageData.page.id != result.newpageid) {
|
||||||
|
// Button to continue the lesson (the page to go is configured by the teacher).
|
||||||
this.processData.buttons.push({
|
this.processData.buttons.push({
|
||||||
label: 'addon.mod_lesson.reviewquestioncontinue',
|
label: 'addon.mod_lesson.reviewquestioncontinue',
|
||||||
pageId: result.newpageid
|
pageId: result.newpageid
|
||||||
});
|
});
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
this.processData.buttons.push({
|
this.processData.buttons.push({
|
||||||
label: 'addon.mod_lesson.continue',
|
label: 'addon.mod_lesson.continue',
|
||||||
|
|
|
@ -156,6 +156,8 @@ export class AddonModLessonProvider {
|
||||||
*/
|
*/
|
||||||
static MULTIANSWER_DELIMITER = '@^#|';
|
static MULTIANSWER_DELIMITER = '@^#|';
|
||||||
|
|
||||||
|
static LESSON_OTHER_ANSWERS = '@#wronganswer#@';
|
||||||
|
|
||||||
// Variables for database.
|
// Variables for database.
|
||||||
static PASSWORD_TABLE = 'addon_mod_lesson_password';
|
static PASSWORD_TABLE = 'addon_mod_lesson_password';
|
||||||
protected siteSchema: CoreSiteSchema = {
|
protected siteSchema: CoreSiteSchema = {
|
||||||
|
@ -793,6 +795,8 @@ export class AddonModLessonProvider {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.checkOtherAnswers(lesson, pageData, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -907,6 +911,8 @@ export class AddonModLessonProvider {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.checkOtherAnswers(lesson, pageData, result);
|
||||||
|
|
||||||
result.userresponse = studentAnswer;
|
result.userresponse = studentAnswer;
|
||||||
result.studentanswer = this.textUtils.s(studentAnswer); // Clean student answer as it goes to output.
|
result.studentanswer = this.textUtils.s(studentAnswer); // Clean student answer as it goes to output.
|
||||||
}
|
}
|
||||||
|
@ -945,6 +951,33 @@ export class AddonModLessonProvider {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check the "other answers" value.
|
||||||
|
*
|
||||||
|
* @param {any} lesson Lesson.
|
||||||
|
* @param {any} pageData Result of getPageData for the page to process.
|
||||||
|
* @param {AddonModLessonCheckAnswerResult} result Object where to store the result.
|
||||||
|
*/
|
||||||
|
protected checkOtherAnswers(lesson: any, pageData: any, result: AddonModLessonCheckAnswerResult): void {
|
||||||
|
// We could check here to see if we have a wrong answer jump to use.
|
||||||
|
if (result.answerid == 0) {
|
||||||
|
// Use the all other answers jump details if it is set up.
|
||||||
|
const lastAnswer = pageData.answers[pageData.answers.length - 1] || {};
|
||||||
|
|
||||||
|
// Double check that this is the OTHER_ANSWERS answer.
|
||||||
|
if (typeof lastAnswer.answer == 'string' &&
|
||||||
|
lastAnswer.answer.indexOf(AddonModLessonProvider.LESSON_OTHER_ANSWERS) != -1) {
|
||||||
|
result.newpageid = lastAnswer.jumpto;
|
||||||
|
result.response = lastAnswer.response;
|
||||||
|
|
||||||
|
if (lesson.custom) {
|
||||||
|
result.correctanswer = lastAnswer.score > 0;
|
||||||
|
}
|
||||||
|
result.answerid = lastAnswer.id;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a list of pages indexed by page ID based on a list of pages.
|
* Create a list of pages indexed by page ID based on a list of pages.
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in New Issue