From 29445273ca7dab4cceb6b343f9dd926dae670d73 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20Doma=C5=84ski?= Date: Fri, 9 Aug 2024 14:12:58 +0200 Subject: [PATCH] [product cache] add not replace --- fooder/domain/product.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fooder/domain/product.py b/fooder/domain/product.py index c3b99eb..1ad7aa3 100644 --- a/fooder/domain/product.py +++ b/fooder/domain/product.py @@ -129,7 +129,8 @@ class Product(Base, CommonMixin): ) ) .values( - usage_count_cached=select(func.count(Entry.id)).where( + usage_count_cached=cls.usage_count_cached + + select(func.count(Entry.id)).where( Entry.product_id == cls.id, Entry.processed == False, )