From 64ca51223328cf3788a7d23e5eb3a435e56b21cd Mon Sep 17 00:00:00 2001 From: Florian Charlier Date: Tue, 12 Apr 2022 15:57:14 +0000 Subject: [PATCH] [FIX] website_slides: fix sign in/buy from quiz for non-members MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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) --- .../static/src/js/slides_course_quiz.js | 20 +++++++------------ .../static/src/xml/slide_course_join.xml | 7 +------ 2 files changed, 8 insertions(+), 19 deletions(-) diff --git a/addons/website_slides/static/src/js/slides_course_quiz.js b/addons/website_slides/static/src/js/slides_course_quiz.js index 175300f8fa4..dfaa8fc3d4b 100644 --- a/addons/website_slides/static/src/js/slides_course_quiz.js +++ b/addons/website_slides/static/src/js/slides_course_quiz.js @@ -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. diff --git a/addons/website_slides/static/src/xml/slide_course_join.xml b/addons/website_slides/static/src/xml/slide_course_join.xml index 0241915c190..d65dd756fe0 100644 --- a/addons/website_slides/static/src/xml/slide_course_join.xml +++ b/addons/website_slides/static/src/xml/slide_course_join.xml @@ -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="#"> - - - Sign in - - - +