From 5804b6230d263100c5852c9c9b9c24f9d8327dba Mon Sep 17 00:00:00 2001 From: Du Peng Date: Thu, 20 Oct 2022 18:23:30 +0200 Subject: [PATCH] (bug) show product count is only active in category --- app/services/product_category_service.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/services/product_category_service.rb b/app/services/product_category_service.rb index 679525d53..b7e8c984d 100644 --- a/app/services/product_category_service.rb +++ b/app/services/product_category_service.rb @@ -4,7 +4,7 @@ class ProductCategoryService def self.list ProductCategory.left_outer_joins(:products) - .select('product_categories.*, count(products.*) as products_count') + .select('product_categories.*, count(products.*) filter (where is_active is true) as products_count') .group('product_categories.id') end