[FIX] website_slides: fix quiz karma won

- Install website_slides
- Connect with an user (i.e. Mitchell Admin)
- Go to Website and open a Course quiz for the first time
(i.e. "Test Yourself" from "Basics of Furniture Creation" Course)
- Answer correctly
The number of won karma is the one from the last attempt reward and is not saved
in user's total xp.

When submitting the quiz, quiz_attempts_count is incremented via a SQL query,
but its value is not updated in cache directly.
When the karma gain is computed from the attempts count, the value used is the
old one in cache.

opw-2389969

closes odoo/odoo#62500

X-original-commit: d8254c130d4b04a0f1ff80990fe28e795bf9ad51
Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
Signed-off-by: Anh Thao PHAM <kitan191@users.noreply.github.com>
This commit is contained in:
Anh Thao Pham (pta)
2020-11-27 10:20:32 +00:00
parent 058ba7b907
commit ec04b04b1e
@@ -632,6 +632,7 @@ class Slide(models.Model):
])
if quiz_attempts_inc and existing_sudo:
sql.increment_field_skiplock(existing_sudo, 'quiz_attempts_count')
SlidePartnerSudo.invalidate_cache(fnames=['quiz_attempts_count'], ids=existing_sudo.ids)
new_slides = self_sudo - existing_sudo.mapped('slide_id')
return SlidePartnerSudo.create([{