From 1dee7d6f93c209688a728714bb4d3c11a3b7e05e Mon Sep 17 00:00:00 2001 From: Du Peng Date: Tue, 18 Oct 2022 12:45:03 +0200 Subject: [PATCH] (bug) cannot generate order statistic if no set a category --- app/services/statistics/concerns/store_orders_concern.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/services/statistics/concerns/store_orders_concern.rb b/app/services/statistics/concerns/store_orders_concern.rb index f5b44b77e..422c74502 100644 --- a/app/services/statistics/concerns/store_orders_concern.rb +++ b/app/services/statistics/concerns/store_orders_concern.rb @@ -16,6 +16,7 @@ module Statistics::Concerns::StoreOrdersConcern .where(orderable_type: 'Product') .map(&:orderable) .map(&:product_category) + .compact .map { |cat| { id: cat.id, name: cat.name } } .uniq end