From 8d27fdfae0239bb17f1ae1ea53ec3b54bbae2dd4 Mon Sep 17 00:00:00 2001 From: Methapon2001 <61303214+Methapon2001@users.noreply.github.com> Date: Wed, 19 Feb 2025 15:15:04 +0700 Subject: [PATCH] fix: wrong canceled count --- src/controllers/05-quotation-controller.ts | 25 ++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/src/controllers/05-quotation-controller.ts b/src/controllers/05-quotation-controller.ts index 4555920..8278e10 100644 --- a/src/controllers/05-quotation-controller.ts +++ b/src/controllers/05-quotation-controller.ts @@ -282,20 +282,33 @@ export class QuotationController extends Controller { select: { requestWork: { where: { + OR: [ + { request: { requestDataStatus: RequestDataStatus.Canceled } }, + { stepStatus: { some: { workStatus: RequestWorkStatus.Canceled } } }, + ], creditNoteId: null, - stepStatus: { some: { workStatus: RequestWorkStatus.Canceled } }, }, }, }, }, }, where: { - requestWork: { - some: { - creditNoteId: null, - stepStatus: { some: { workStatus: RequestWorkStatus.Canceled } }, + OR: [ + { + requestDataStatus: RequestDataStatus.Canceled, + requestWork: { + some: { creditNoteId: null }, + }, }, - }, + { + requestWork: { + some: { + creditNoteId: null, + stepStatus: { some: { workStatus: RequestWorkStatus.Canceled } }, + }, + }, + }, + ], quotationId: { in: result.map((v) => v.id) }, }, });