From d14df62c84324424589986f11b834030ef4f0352 Mon Sep 17 00:00:00 2001 From: Yagnik Date: Wed, 11 Oct 2023 15:04:38 +0530 Subject: [PATCH] subsegments of used segment will show as used in segments list --- .../Upgrade/src/api/services/SegmentService.ts | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/backend/packages/Upgrade/src/api/services/SegmentService.ts b/backend/packages/Upgrade/src/api/services/SegmentService.ts index 14ceb02b78..89469a980d 100644 --- a/backend/packages/Upgrade/src/api/services/SegmentService.ts +++ b/backend/packages/Upgrade/src/api/services/SegmentService.ts @@ -110,6 +110,24 @@ export class SegmentService { }); } + segmentsData.forEach((segment) => { + segmentsUsedLockedList.forEach((usedSegment) => { + if (segment.id === usedSegment) { + segment.subSegments.forEach((subSegment) => { + segmentsUsedLockedList.push(subSegment.id); + }); + } + }); + + segmentsUsedUnlockedList.forEach((usedSegment) => { + if (segment.id === usedSegment) { + segment.subSegments.forEach((subSegment) => { + segmentsUsedUnlockedList.push(subSegment.id); + }); + } + }); + }); + const segmentsDataWithStatus = segmentsData.map((segment) => { if (segment.id === globalExcludeSegment.id) { return { ...segment, status: SEGMENT_STATUS.GLOBAL };