From 250aef45140d5559c74f9b519d3eb07ecdcf6537 Mon Sep 17 00:00:00 2001 From: Vivek Yadav <105432992+VivekY1098@users.noreply.github.com> Date: Tue, 17 Dec 2024 18:47:57 +0530 Subject: [PATCH] resolve the duplicate issue --- .../object-detail/object-detail.component.ts | 30 +++++++++++++------ 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/ui/src/app/components/object-detail/object-detail.component.ts b/ui/src/app/components/object-detail/object-detail.component.ts index 86802675c..a7ba945c9 100644 --- a/ui/src/app/components/object-detail/object-detail.component.ts +++ b/ui/src/app/components/object-detail/object-detail.component.ts @@ -918,7 +918,7 @@ export class ObjectDetailComponent implements OnInit { let isDuplicate = false; this.ccArray.value.forEach((cc: ICcTabData) => { - if(cc.spConstraintName && cc.spConstraintCondition){ + if (cc.spConstraintName && cc.spConstraintCondition) { if (spCkArr.some(item => item.Name === cc.spConstraintName || item.Expr === cc.spConstraintCondition)) { isDuplicate = true; } else { @@ -926,16 +926,28 @@ export class ObjectDetailComponent implements OnInit { Id: cc.spSno, Name: cc.spConstraintName, Expr: cc.spConstraintCondition, + ExprId: cc.spExprId }); } - } - else{ - spCkArr.push({ - Id: cc.spSno, - Name: cc.spConstraintName, - Expr: cc.spConstraintCondition, - }); - } + } else if (cc.spConstraintCondition) { + if (spCkArr.some(item => item.Expr === cc.spConstraintCondition)) { + isDuplicate = true; + } else { + spCkArr.push({ + Id: cc.spSno, + Name: cc.spConstraintName, + Expr: cc.spConstraintCondition, + ExprId: cc.spExprId + }); + } + } else { + spCkArr.push({ + Id: cc.spSno, + Name: cc.spConstraintName, + Expr: cc.spConstraintCondition, + ExprId: cc.spExprId + }); + } }); if (isDuplicate) {