From 61c93625a55024e7b8dd7f4a0f9265089d3520d2 Mon Sep 17 00:00:00 2001 From: Twilight <46562212+twlite@users.noreply.github.com> Date: Sat, 20 Dec 2025 10:41:15 +0545 Subject: [PATCH 1/2] fix(PromotionService): exclude seller orders when counting promotion usage --- packages/core/src/service/services/promotion.service.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/core/src/service/services/promotion.service.ts b/packages/core/src/service/services/promotion.service.ts index ee9c57ce11..8edf10ba98 100644 --- a/packages/core/src/service/services/promotion.service.ts +++ b/packages/core/src/service/services/promotion.service.ts @@ -349,7 +349,8 @@ export class PromotionService { .where('promotion.id = :promotionId', { promotionId }) .andWhere('order.customer = :customerId', { customerId }) .andWhere('order.state != :state', { state: 'Cancelled' as OrderState }) - .andWhere('order.active = :active', { active: false }); + .andWhere('order.active = :active', { active: false }) + .andWhere('order.type != :type', { type: 'Seller' }); return qb.getCount(); } @@ -361,7 +362,8 @@ export class PromotionService { .leftJoin('order.promotions', 'promotion') .where('promotion.id = :promotionId', { promotionId }) .andWhere('order.state != :state', { state: 'Cancelled' as OrderState }) - .andWhere('order.active = :active', { active: false }); + .andWhere('order.active = :active', { active: false }) + .andWhere('order.type != :type', { type: 'Seller' }); return qb.getCount(); } From c803ba1c643d58131a877773b737d875599819ea Mon Sep 17 00:00:00 2001 From: Twilight <46562212+twlite@users.noreply.github.com> Date: Sat, 20 Dec 2025 10:51:14 +0545 Subject: [PATCH 2/2] refactor: use OrderType enum --- packages/core/src/service/services/promotion.service.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/core/src/service/services/promotion.service.ts b/packages/core/src/service/services/promotion.service.ts index 8edf10ba98..23fec22440 100644 --- a/packages/core/src/service/services/promotion.service.ts +++ b/packages/core/src/service/services/promotion.service.ts @@ -8,6 +8,7 @@ import { CreatePromotionResult, DeletionResponse, DeletionResult, + OrderType, RemovePromotionsFromChannelInput, UpdatePromotionInput, UpdatePromotionResult, @@ -350,7 +351,7 @@ export class PromotionService { .andWhere('order.customer = :customerId', { customerId }) .andWhere('order.state != :state', { state: 'Cancelled' as OrderState }) .andWhere('order.active = :active', { active: false }) - .andWhere('order.type != :type', { type: 'Seller' }); + .andWhere('order.type != :type', { type: OrderType.Seller }); return qb.getCount(); } @@ -363,7 +364,7 @@ export class PromotionService { .where('promotion.id = :promotionId', { promotionId }) .andWhere('order.state != :state', { state: 'Cancelled' as OrderState }) .andWhere('order.active = :active', { active: false }) - .andWhere('order.type != :type', { type: 'Seller' }); + .andWhere('order.type != :type', { type: OrderType.Seller }); return qb.getCount(); }