From b237fa2986ea7154bc658b6db34c017a9ff53035 Mon Sep 17 00:00:00 2001 From: vishnu vinay Date: Fri, 24 Jan 2025 12:59:32 +0530 Subject: [PATCH] Bug #233498 - FIx status filter in cohort list for cohort admin role --- src/adapters/postgres/cohort-adapter.ts | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/adapters/postgres/cohort-adapter.ts b/src/adapters/postgres/cohort-adapter.ts index bad15ec..4a6b4d3 100644 --- a/src/adapters/postgres/cohort-adapter.ts +++ b/src/adapters/postgres/cohort-adapter.ts @@ -803,11 +803,17 @@ export class PostgresCohortService { count = totalCount; let cohortIds = data.map(cohortId => cohortId.cohortId); + let whereClauseCondition: any = { + cohortId: In(cohortIds), + tenantId: filters.tenantId, + }; + + if (filters.status && filters.status.length > 0) { + whereClauseCondition.status = In(filters.status); + } + let cohortAllData = await this.cohortRepository.find({ - where: { - cohortId: In(cohortIds), - tenantId : filters.tenantId - }, + where: whereClauseCondition, }); for (let data of cohortAllData) {