From 0603fe320c0062639b3d100eedba661dd760319c Mon Sep 17 00:00:00 2001 From: Egor fureunoir Gorbunov Date: Fri, 27 Feb 2026 21:58:56 +0300 Subject: [PATCH] style(models): reformat price aggregation queries for readability Improves code readability by restructuring the `min_price` and `max_price` methods into a more concise and consistent format. No functional changes introduced. --- engine/core/models.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/engine/core/models.py b/engine/core/models.py index 3bcacd05..714f060d 100644 --- a/engine/core/models.py +++ b/engine/core/models.py @@ -464,18 +464,18 @@ class Category(NiceModel, MPTTModel): @cached_property def min_price(self) -> float: return ( - self.products.filter( - is_active=True, stocks__is_active=True - ).aggregate(Min("stocks__price"))["stocks__price__min"] + self.products.filter(is_active=True, stocks__is_active=True).aggregate( + Min("stocks__price") + )["stocks__price__min"] or 0.0 ) @cached_property def max_price(self) -> float: return ( - self.products.filter( - is_active=True, stocks__is_active=True - ).aggregate(Max("stocks__price"))["stocks__price__max"] + self.products.filter(is_active=True, stocks__is_active=True).aggregate( + Max("stocks__price") + )["stocks__price__max"] or 0.0 )