From bfe3f7c84c3252e6345027f4bb85ba5ea6a71f36 Mon Sep 17 00:00:00 2001 From: Bright Date: Fri, 7 Feb 2025 12:03:58 +0700 Subject: [PATCH] =?UTF-8?q?fix=20=E0=B8=AA=E0=B9=88=E0=B8=87=E0=B8=8A?= =?UTF-8?q?=E0=B8=B7=E0=B9=88=E0=B8=AD=E0=B9=84=E0=B8=9B=E0=B8=9E=E0=B8=B1?= =?UTF-8?q?=E0=B8=81=E0=B8=A3=E0=B8=B2=E0=B8=8A=E0=B8=81=E0=B8=B2=E0=B8=A3?= =?UTF-8?q?=E0=B9=81=E0=B8=95=E0=B9=88=E0=B8=96=E0=B8=B9=E0=B8=81=E0=B8=9B?= =?UTF-8?q?=E0=B8=A5=E0=B8=94=E0=B8=81=E0=B8=B4=E0=B9=88=E0=B8=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/controllers/CommandController.ts | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/controllers/CommandController.ts b/src/controllers/CommandController.ts index 3ff4a85c..b1b76e79 100644 --- a/src/controllers/CommandController.ts +++ b/src/controllers/CommandController.ts @@ -3485,7 +3485,6 @@ export class CommandController extends Controller { _profile.lastUpdateFullName = req.user.name; _profile.lastUpdatedAt = new Date(); if (item.isLeave == true) { - await removeProfileInOrganize(_profile.id, "OFFICER"); const exceptClear = await checkExceptCommandType(String(item.commandId)); if (exceptClear.status) { _profile.leaveReason = item.leaveReason ?? _null; @@ -3495,6 +3494,9 @@ export class CommandController extends Controller { _profile.leaveDate = item.date ?? _null; _profile.leaveType = exceptClear.LeaveType ?? _null; } + else { + await removeProfileInOrganize(_profile.id, "OFFICER"); + } } const clearProfile = await checkCommandType(String(item.commandId)); if (clearProfile.status) { @@ -3676,7 +3678,6 @@ export class CommandController extends Controller { _profile.lastUpdateFullName = req.user.name; _profile.lastUpdatedAt = new Date(); if (item.isLeave == true) { - await removeProfileInOrganize(_profile.id, "EMPLOYEE"); const exceptClear = await checkExceptCommandType(String(item.commandId)); if (exceptClear.status) { _profile.leaveReason = item.leaveReason ?? _null; @@ -3686,6 +3687,9 @@ export class CommandController extends Controller { _profile.leaveDate = item.date ?? _null; _profile.leaveType = exceptClear.LeaveType ?? _null; } + else { + await removeProfileInOrganize(_profile.id, "EMPLOYEE"); + } } const clearProfile = await checkCommandType(String(item.commandId)); if (clearProfile.status) { @@ -3903,7 +3907,6 @@ export class CommandController extends Controller { _profile.lastUpdateFullName = req.user.name; _profile.lastUpdatedAt = new Date(); if (item.isLeave == true) { - await removeProfileInOrganize(_profile.id, "EMPLOYEE"); const exceptClear = await checkExceptCommandType(String(item.commandId)); if (exceptClear.status) { _profile.leaveReason = item.leaveReason ?? _null; @@ -3913,6 +3916,9 @@ export class CommandController extends Controller { _profile.leaveDate = item.date ?? _null; _profile.leaveType = exceptClear.LeaveType ?? _null; } + else { + await removeProfileInOrganize(_profile.id, "EMPLOYEE"); + } } const clearProfile = await checkCommandType(String(item.commandId)); if (clearProfile.status) {