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) {