diff --git a/src/controllers/ProfileController.ts b/src/controllers/ProfileController.ts index 7b883d73..b49581d0 100644 --- a/src/controllers/ProfileController.ts +++ b/src/controllers/ProfileController.ts @@ -1389,10 +1389,6 @@ export class ProfileController extends Controller { } }); - // if (leaves.length === 0) { - // leaves.push({year:""}); - // } - // Query มาสาย/ขาดราชการ และ merge ตามปี const absentLate_raw = await this.profileAbsentLateRepo .createQueryBuilder("absentLate") @@ -1438,11 +1434,15 @@ export class ProfileController extends Controller { } }); - // เติมค่า "" ถ้าไม่มีข้อมูลมาสาย/ขาดราชการ - leaves.forEach((yearData) => { - if (!yearData.late) yearData.late = ""; - if (!yearData.absent) yearData.absent = ""; - }); + // // เติมค่า "" ถ้าไม่มีข้อมูลมาสาย/ขาดราชการ + // leaves.forEach((yearData) => { + // if (!yearData.late) yearData.late = ""; + // if (!yearData.absent) yearData.absent = ""; + // }); + + if (leaves.length === 0) { + leaves.push({year:""}); + } const leave2_raw = await this.profileLeaveRepository .createQueryBuilder("profileLeave") diff --git a/src/controllers/ProfileEmployeeController.ts b/src/controllers/ProfileEmployeeController.ts index dee9c6d0..a1ac02af 100644 --- a/src/controllers/ProfileEmployeeController.ts +++ b/src/controllers/ProfileEmployeeController.ts @@ -1425,10 +1425,6 @@ export class ProfileEmployeeController extends Controller { } }); - // if (leaves.length === 0) { - // leaves.push({year:""}); - // } - // Query มาสาย/ขาดราชการ และ merge ตามปี const absentLate_raw = await this.profileEmployeeAbsentLateRepo .createQueryBuilder("absentLate") @@ -1474,11 +1470,15 @@ export class ProfileEmployeeController extends Controller { } }); - // เติมค่า "" ถ้าไม่มีข้อมูลมาสาย/ขาดราชการ - leaves.forEach((yearData) => { - if (!yearData.lateAmount) yearData.lateAmount = ""; - if (!yearData.absentAmount) yearData.absentAmount = ""; - }); + // // เติมค่า "" ถ้าไม่มีข้อมูลมาสาย/ขาดราชการ + // leaves.forEach((yearData) => { + // if (!yearData.lateAmount) yearData.lateAmount = ""; + // if (!yearData.absentAmount) yearData.absentAmount = ""; + // }); + + if (leaves.length === 0) { + leaves.push({year:""}); + } const leave2_raw = await this.profileLeaveRepository .createQueryBuilder("profileLeave")