Files
odoo_source/addons/website_slides
Pierre-Yves Dufays 10bb041a45 [FIX] website_slides: fix duplicate quiz
How to reproduce:
1. Open eLearning app
2. Go to any course having document with quiz.
3. Solve the quiz
4. Click multiple time quickly on 'Done' (green tick) button.
5. Multiple quiz are displayed if your connection is slow or you click fast
enough.

The fix ensures that only one quiz is displayed. We do the same change for
video to prevent such problem with them.

Technical note: when clicking on the "green tick" of the quiz, the method
_toggleSlideCompleted is called which cause a _renderSlide. That method clears
the content div (o_wslides_fs_content) and appends a new Quiz widget to that
div. The problem is that the "append" is asynchronous (it call the "willStart"
of Quiz widget that fetch the quiz) so if you click multiple time, the content
div is cleared multiple times and then after each quiz created is ready (after
having fetched the data), they are appended to the content div, resulting in
multiple quiz displayed.

We solve the problem by avoiding concurrent execution of the _renderSlide
method: the body of the method is skipped when the rendering is ongoing (for
example while waiting the quiz from the server). As the method is inserting the
slide at the same place, its behavior was anyway unpredictable because
depending on the response time of each request. By skipping the method body
while already running we make it a bit more predictable, avoid the content
duplication on the page, and we avoid unnecessary call to the server.

Task-3412847

closes odoo/odoo#154069

X-original-commit: 72e035274de3bbf7fcc858008bc00d095163e7f3
Signed-off-by: Stéphane Debauche (std) <std@odoo.com>
Signed-off-by: Pierre-Yves Dufays (pydu) <pydu@odoo.com>
2024-02-19 17:53:12 +00:00
..
2023-11-02 21:02:44 +00:00