Skip to content

Commit

Permalink
fix(KMS-20622) missing quiz bubbles after retake (#4145)
Browse files Browse the repository at this point in the history
fix(KMS-20782) cannot submit last reflection point after retake
  • Loading branch information
eitanavgil authored Apr 1, 2020
1 parent bf01dff commit 6f7ec43
Showing 1 changed file with 23 additions and 12 deletions.
35 changes: 23 additions & 12 deletions modules/Quiz/resources/quiz.js
Original file line number Diff line number Diff line change
Expand Up @@ -275,21 +275,20 @@
var _this = this;
if(data.objectType === "KalturaAPIException"){
_this.KIVQModule.errMsg('Error', data);
mw.log("Quiz: retakeSuccess Error");
}else{
_this.KIVQModule.sendIVQMesageToListener("QuizRetake");
// reset quiz and KIVQModule
this.destroy();
this.KIVQModule.destroy();
this.KIVQModule.setupQuiz().then(function(){
// new quiz data is now loaded - proceed with CPs loading
_this.KIVQModule.getQuestionsAndAnswers(function(){
setTimeout(function () {
_this.embedPlayer.stopPlayAfterSeek = false;
_this.embedPlayer.seek(0,false);
_this.ivqHideScreen()
},50);
})
})
mw.log("Quiz: retakeSuccess setupQuiz");
setTimeout(function () {
_this.embedPlayer.stopPlayAfterSeek = false;
_this.embedPlayer.seek(0,false);
_this.ivqHideScreen();
},800);
});
}
},

Expand Down Expand Up @@ -1084,7 +1083,18 @@
+ '/' + $.cpObject.cpArray.length + '</span>'));

$(".ftr-right").html(gM('mwe-quiz-next')).on('click', function () {
_this.KIVQModule.continuePlay();
mw.log("Quiz: Skip/Continue clicked reviewMode");
if(_this.isReflectionPoint($.cpObject.cpArray[questionNr]) && !$.cpObject.cpArray[questionNr].isAnswerd ) {
mw.log("Quiz: reflection point - submit");
$(this).off(); // disable 2nd click to prevent double submission
// only on reflection point - when clicking on continue - submit the question and wait as all other questions
_this.KIVQModule.submitAnswer(questionNr,0);
setTimeout(function(){
_this.KIVQModule.continuePlay();
},_this.postAnswerTimer);
}else{
_this.KIVQModule.continuePlay();
}
}).attr({'tabindex': 6.3, "role" : "button"}).on('keydown', _this.keyDownHandler);
} else {
$(".ftr-left").append($('<p id="ftr-question">' + gM('mwe-quiz-question') + ' ' + this.KIVQModule.i2q(questionNr)
Expand Down Expand Up @@ -1119,8 +1129,9 @@
}).on('keydown', _this.keyDownHandler).attr('tabindex', 5).attr('role', 'button');
}else if(!_this.KIVQModule.canSkip && ( $.cpObject.cpArray[questionNr].isAnswerd || _this.isReflectionPoint($.cpObject.cpArray[questionNr])) ){
$(".ftr-right").html(gM('mwe-quiz-next')).on('click', function () {
if(_this.isReflectionPoint($.cpObject.cpArray[questionNr])) {
mw.log("Quiz: reflection point - Skip/Continue clicked");
mw.log("Quiz: reflection point - Skip/Continue clicked");
if(_this.isReflectionPoint($.cpObject.cpArray[questionNr]) && !$.cpObject.cpArray[questionNr].isAnswerd ) {
mw.log("Quiz: reflection point - submit");
$(this).off(); // disable 2nd click to prevent double submission
// only on reflection point - when clicking on continue - submit the question and wait as all other questions
_this.KIVQModule.submitAnswer(questionNr,0);
Expand Down

0 comments on commit 6f7ec43

Please sign in to comment.