[FIX] website_slides: fix sign in/buy from quiz for non-members
When a non-logged in visitor tried to validate answers on a quiz page but had
not answered all questions, the button seemed unresponsive.
In fact, the place was not there to show the error message; likely introduced
by 4a329da6a0.
However, instead of restoring the error message for this corner-case, we
considered it was acceptable to change the behavior a little and not block the
visitor who'd like to sign-in/join at this point, as the validation of the quiz
will still be blocked if not all questions are answered with an error message.
Also, as the quiz does get validated when the button is used even though
the user is not yet logged in, it makes sense to also label it 'Join & Submit'
instead of only 'Sign-in'.
Task-2821644
Part of Task-2663320
closes odoo/odoo#91674
X-original-commit: 1e568dab391db809235615a3a2b0dbe3fabc97cc
Signed-off-by: Warnon Aurélien (awa) <awa@odoo.com>
This commit is contained in:
@@ -470,20 +470,14 @@
|
||||
* @private
|
||||
*/
|
||||
_saveQuizAnswersToSession: function () {
|
||||
var quizAnswers = this._getQuizAnswers();
|
||||
if (quizAnswers.length === this.quiz.questions.length) {
|
||||
this._hideErrorMessage();
|
||||
this._hideErrorMessage();
|
||||
|
||||
return this._rpc({
|
||||
route: '/slides/slide/quiz/save_to_session',
|
||||
params: {
|
||||
'quiz_answers': {'slide_id': this.slide.id, 'slide_answers': quizAnswers},
|
||||
}
|
||||
});
|
||||
} else {
|
||||
this._showErrorMessage('slide_quiz_incomplete');
|
||||
return Promise.reject('The quiz is incomplete');
|
||||
}
|
||||
return this._rpc({
|
||||
route: '/slides/slide/quiz/save_to_session',
|
||||
params: {
|
||||
'quiz_answers': {'slide_id': this.slide.id, 'slide_answers': this._getQuizAnswers()},
|
||||
}
|
||||
});
|
||||
},
|
||||
/**
|
||||
* After joining the course, we immediately submit the quiz and get the correction.
|
||||
|
||||
@@ -6,12 +6,7 @@
|
||||
class="btn btn-primary o_wslides_js_course_join_link text-uppercase font-weight-bold"
|
||||
title="Join the Course" aria-label="Join the Course"
|
||||
href="#">
|
||||
<t t-if="widget.channel.channelEnroll == 'public'">
|
||||
<t t-if="widget.publicUser">
|
||||
Sign in
|
||||
</t>
|
||||
<t t-else="" t-esc="widget.joinMessage" />
|
||||
</t>
|
||||
<t t-if="widget.channel.channelEnroll == 'public'" t-esc="widget.joinMessage"/>
|
||||
</a>
|
||||
</div>
|
||||
</t>
|
||||
|
||||
Reference in New Issue
Block a user