test snap

This commit is contained in:
kittapath 2025-07-15 23:52:51 +07:00
parent ab7544373d
commit 79686e5d45

View file

@ -2820,8 +2820,12 @@ export class SalaryPeriodController extends Controller {
console.log("mlength", orgProfileEmployees.length); console.log("mlength", orgProfileEmployees.length);
// const profilesEmpToSave: SalaryProfileEmployee[] = []; // const profilesEmpToSave: SalaryProfileEmployee[] = [];
console.time("⏱ SalaryProfileEmployee - Total Time"); console.time("⏱ SalaryProfileEmployee - Total Time");
await Promise.all( // await Promise.all(
orgProfileEmployees.map(async (profile: any) => { // orgProfileEmployees.map(async (profile: any) => {
const batchSize = 1000;
for (let i = 0; i < orgProfileEmployees.length; i += batchSize) {
const profile = orgProfileEmployees.slice(i, i + batchSize);
const salaryOrgNew = await this.salaryOrgEmployeeRepository.findOne({ const salaryOrgNew = await this.salaryOrgEmployeeRepository.findOne({
where: { where: {
salaryPeriodId: salaryPeriod.id, salaryPeriodId: salaryPeriod.id,
@ -2893,8 +2897,8 @@ export class SalaryPeriodController extends Controller {
`⚠️ [SNAP: ${snapshot}] ไม่พบ salaryOrgEmployee สำหรับ rootId: ${profile.rootId}`, `⚠️ [SNAP: ${snapshot}] ไม่พบ salaryOrgEmployee สำหรับ rootId: ${profile.rootId}`,
); );
} }
}), }
); // );
console.timeEnd("⏱ SalaryProfileEmployee - Total Time"); console.timeEnd("⏱ SalaryProfileEmployee - Total Time");
} }