From ec04b04b1ecd66b94b7e6e8e4eccda9b496e2e20 Mon Sep 17 00:00:00 2001 From: "Anh Thao Pham (pta)" Date: Thu, 26 Nov 2020 14:30:51 +0000 Subject: [PATCH] [FIX] website_slides: fix quiz karma won MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 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) Signed-off-by: Anh Thao PHAM --- addons/website_slides/models/slide_slide.py | 1 + 1 file changed, 1 insertion(+) diff --git a/addons/website_slides/models/slide_slide.py b/addons/website_slides/models/slide_slide.py index 889cc58bf4d..00bd90ea7bc 100644 --- a/addons/website_slides/models/slide_slide.py +++ b/addons/website_slides/models/slide_slide.py @@ -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([{