From 81a919686984af1453ee0ffc2b1860f33157f451 Mon Sep 17 00:00:00 2001 From: AdisakKanthawilang Date: Wed, 26 Jun 2024 09:37:31 +0700 Subject: [PATCH] fix --- src/controllers/PositionController.ts | 80 ++++++++++++++++++++------- 1 file changed, 60 insertions(+), 20 deletions(-) diff --git a/src/controllers/PositionController.ts b/src/controllers/PositionController.ts index 6bb59831..7299fccc 100644 --- a/src/controllers/PositionController.ts +++ b/src/controllers/PositionController.ts @@ -2585,58 +2585,78 @@ export class PositionController extends Controller { typeCondition = { orgRootId: body.nodeId, orgChild1Id: IsNull(), - current_holderId: body.isBlank == true ? IsNull() : Not(IsNull()), }; + if (body.isBlank == true) { + typeCondition.current_holderId = IsNull(); + } } else if (body.node === 1) { typeCondition = { orgChild1Id: body.nodeId, orgChild2Id: IsNull(), - current_holderId: body.isBlank == true ? IsNull() : Not(IsNull()), }; + if (body.isBlank == true) { + typeCondition.current_holderId = IsNull(); + } } else if (body.node === 2) { typeCondition = { orgChild2Id: body.nodeId, orgChild3Id: IsNull(), - current_holderId: body.isBlank == true ? IsNull() : Not(IsNull()), }; + if (body.isBlank == true) { + typeCondition.current_holderId = IsNull(); + } } else if (body.node === 3) { typeCondition = { orgChild3Id: body.nodeId, orgChild4Id: IsNull(), - current_holderId: body.isBlank == true ? IsNull() : Not(IsNull()), }; + if (body.isBlank == true) { + typeCondition.current_holderId = IsNull(); + } } else if (body.node === 4) { typeCondition = { orgChild4Id: body.nodeId, - current_holderId: body.isBlank == true ? IsNull() : Not(IsNull()), }; + if (body.isBlank == true) { + typeCondition.current_holderId = IsNull(); + } } } else { if (body.node === 0) { typeCondition = { orgRootId: body.nodeId, - current_holderId: body.isBlank == true ? IsNull() : Not(IsNull()), }; + if (body.isBlank == true) { + typeCondition.current_holderId = IsNull(); + } } else if (body.node === 1) { typeCondition = { orgChild1Id: body.nodeId, - current_holderId: body.isBlank == true ? IsNull() : Not(IsNull()), }; + if (body.isBlank == true) { + typeCondition.current_holderId = IsNull(); + } } else if (body.node === 2) { typeCondition = { orgChild2Id: body.nodeId, - current_holderId: body.isBlank == true ? IsNull() : Not(IsNull()), }; + if (body.isBlank == true) { + typeCondition.current_holderId = IsNull(); + } } else if (body.node === 3) { typeCondition = { orgChild3Id: body.nodeId, - current_holderId: body.isBlank == true ? IsNull() : Not(IsNull()), }; + if (body.isBlank == true) { + typeCondition.current_holderId = IsNull(); + } } else if (body.node === 4) { typeCondition = { orgChild4Id: body.nodeId, - current_holderId: body.isBlank == true ? IsNull() : Not(IsNull()), }; + if (body.isBlank == true) { + typeCondition.current_holderId = IsNull(); + } } } @@ -2818,58 +2838,78 @@ export class PositionController extends Controller { typeCondition = { orgRootId: body.nodeId, orgChild1Id: IsNull(), - current_holderId: body.isBlank == true ?? IsNull(), }; + if (body.isBlank == true) { + typeCondition.current_holderId = IsNull(); + } } else if (body.node === 1) { typeCondition = { orgChild1Id: body.nodeId, orgChild2Id: IsNull(), - current_holderId: body.isBlank == true ?? IsNull(), }; + if (body.isBlank == true) { + typeCondition.current_holderId = IsNull(); + } } else if (body.node === 2) { typeCondition = { orgChild2Id: body.nodeId, orgChild3Id: IsNull(), - current_holderId: body.isBlank == true ?? IsNull(), }; + if (body.isBlank == true) { + typeCondition.current_holderId = IsNull(); + } } else if (body.node === 3) { typeCondition = { orgChild3Id: body.nodeId, orgChild4Id: IsNull(), - current_holderId: body.isBlank == true ?? IsNull(), }; + if (body.isBlank == true) { + typeCondition.current_holderId = IsNull(); + } } else if (body.node === 4) { typeCondition = { orgChild4Id: body.nodeId, - current_holderId: body.isBlank == true ?? IsNull(), }; + if (body.isBlank == true) { + typeCondition.current_holderId = IsNull(); + } } } else { if (body.node === 0) { typeCondition = { orgRootId: body.nodeId, - current_holderId: body.isBlank == true ?? IsNull(), }; + if (body.isBlank == true) { + typeCondition.current_holderId = IsNull(); + } } else if (body.node === 1) { typeCondition = { orgChild1Id: body.nodeId, - current_holderId: body.isBlank == true ?? IsNull(), }; + if (body.isBlank == true) { + typeCondition.current_holderId = IsNull(); + } } else if (body.node === 2) { typeCondition = { orgChild2Id: body.nodeId, - current_holderId: body.isBlank == true ?? IsNull(), }; + if (body.isBlank == true) { + typeCondition.current_holderId = IsNull(); + } } else if (body.node === 3) { typeCondition = { orgChild3Id: body.nodeId, - current_holderId: body.isBlank == true ?? IsNull(), }; + if (body.isBlank == true) { + typeCondition.current_holderId = IsNull(); + } } else if (body.node === 4) { typeCondition = { orgChild4Id: body.nodeId, - current_holderId: body.isBlank == true ?? IsNull(), }; + if (body.isBlank == true) { + typeCondition.current_holderId = IsNull(); + } } }