From f80e53804a50774fcf3c7ae613cc5f3252fedd88 Mon Sep 17 00:00:00 2001 From: Bright Date: Mon, 30 Jun 2025 15:25:25 +0700 Subject: [PATCH] =?UTF-8?q?Fix=20=E0=B8=9A=E0=B8=B1=E0=B8=8D=E0=B8=8A?= =?UTF-8?q?=E0=B8=B5=202=20=E0=B8=9B=E0=B8=A3=E0=B8=B1=E0=B8=9A=E0=B8=A5?= =?UTF-8?q?=E0=B8=B3=E0=B8=94=E0=B8=B1=E0=B8=9A=E0=B8=81=E0=B8=B2=E0=B8=A3?= =?UTF-8?q?=E0=B9=81=E0=B8=AA=E0=B8=94=E0=B8=87=E0=B8=A7=E0=B8=B8=E0=B8=92?= =?UTF-8?q?=E0=B8=B4=20Issue=20#1336?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/controllers/ReportController.ts | 98 ++++++++++++++++++----------- 1 file changed, 63 insertions(+), 35 deletions(-) diff --git a/src/controllers/ReportController.ts b/src/controllers/ReportController.ts index 63939de8..0b6bf5a0 100644 --- a/src/controllers/ReportController.ts +++ b/src/controllers/ReportController.ts @@ -3729,13 +3729,21 @@ export class ReportController extends Controller { posMaster.current_holder.profileEducations != null && posMaster.current_holder.profileEducations.length > 0 ) { - let _education: any = posMaster.current_holder.profileEducations.sort( - (a, b) => - (b.finishDate == null ? 0 : b.finishDate.getTime()) - - (a.finishDate == null ? 0 : a.finishDate.getTime()), - ); + let _education: any = posMaster.current_holder.profileEducations + .filter(x => x.isEducation == true || x.isUse == true) + .sort( + (a, b) => { + // (b.finishDate == null ? 0 : b.finishDate.getTime()) - + // (a.finishDate == null ? 0 : a.finishDate.getTime()), + if (a.isEducation !== b.isEducation) { + return a.isEducation ? -1 : 1 + } + return b.level - a.level + } + ); if (_education.length > 0) { - education = _education[0]; + // education = _education[0]; + education = _education.map((e:any) => e.degree).join(", ") } } let salary: any = ""; @@ -3873,7 +3881,7 @@ export class ReportController extends Controller { : positionMasterProfileOld.positions.find( (x: any) => x.positionIsSelected == true, )?.posExecutive?.posExecutiveName, - education: education == "" ? "" : education.degree, + education: education == "" ? "" : education, salary: salary == "" ? "" : salary.amount, reason: posMaster.reason, }; @@ -4103,13 +4111,18 @@ export class ReportController extends Controller { posMaster.current_holder.profileEducations != null && posMaster.current_holder.profileEducations.length > 0 ) { - let _education: any = posMaster.current_holder.profileEducations.sort( - (a, b) => - (b.finishDate == null ? 0 : b.finishDate.getTime()) - - (a.finishDate == null ? 0 : a.finishDate.getTime()), - ); + let _education: any = posMaster.current_holder.profileEducations + .filter(x => x.isEducation == true || x.isUse == true) + .sort( + (a, b) => { + if (a.isEducation !== b.isEducation) { + return a.isEducation ? -1 : 1 + } + return b.level - a.level + } + ); if (_education.length > 0) { - education = _education[0]; + education = _education.map((e:any) => e.degree).join(", ") } } let salary: any = ""; @@ -4247,7 +4260,7 @@ export class ReportController extends Controller { : positionMasterProfileOld.positions.find( (x: any) => x.positionIsSelected == true, )?.posExecutive?.posExecutiveName, - education: education == "" ? "" : education.degree, + education: education == "" ? "" : education, salary: salary == "" ? "" : salary.amount, reason: posMaster.reason, }; @@ -4485,13 +4498,18 @@ export class ReportController extends Controller { posMaster.current_holder.profileEducations != null && posMaster.current_holder.profileEducations.length > 0 ) { - let _education: any = posMaster.current_holder.profileEducations.sort( - (a, b) => - (b.finishDate == null ? 0 : b.finishDate.getTime()) - - (a.finishDate == null ? 0 : a.finishDate.getTime()), - ); + let _education: any = posMaster.current_holder.profileEducations + .filter(x => x.isEducation == true || x.isUse == true) + .sort( + (a, b) => { + if (a.isEducation !== b.isEducation) { + return a.isEducation ? -1 : 1 + } + return b.level - a.level + } + ); if (_education.length > 0) { - education = _education[0]; + education = _education.map((e:any) => e.degree).join(", ") } } let salary: any = ""; @@ -4629,7 +4647,7 @@ export class ReportController extends Controller { : positionMasterProfileOld.positions.find( (x: any) => x.positionIsSelected == true, )?.posExecutive?.posExecutiveName, - education: education == "" ? "" : education.degree, + education: education == "" ? "" : education, salary: salary == "" ? "" : salary.amount, reason: posMaster.reason, }; @@ -4883,13 +4901,18 @@ export class ReportController extends Controller { posMaster.current_holder.profileEducations != null && posMaster.current_holder.profileEducations.length > 0 ) { - let _education: any = posMaster.current_holder.profileEducations.sort( - (a, b) => - (b.finishDate == null ? 0 : b.finishDate.getTime()) - - (a.finishDate == null ? 0 : a.finishDate.getTime()), - ); + let _education: any = posMaster.current_holder.profileEducations + .filter(x => x.isEducation == true || x.isUse == true) + .sort( + (a, b) => { + if (a.isEducation !== b.isEducation) { + return a.isEducation ? -1 : 1 + } + return b.level - a.level + } + ); if (_education.length > 0) { - education = _education[0]; + education = _education.map((e:any) => e.degree).join(", ") } } let salary: any = ""; @@ -5027,7 +5050,7 @@ export class ReportController extends Controller { : positionMasterProfileOld.positions.find( (x: any) => x.positionIsSelected == true, )?.posExecutive?.posExecutiveName, - education: education == "" ? "" : education.degree, + education: education == "" ? "" : education, salary: salary == "" ? "" : salary.amount, reason: posMaster.reason, }; @@ -5285,13 +5308,18 @@ export class ReportController extends Controller { posMaster.current_holder.profileEducations != null && posMaster.current_holder.profileEducations.length > 0 ) { - let _education: any = posMaster.current_holder.profileEducations.sort( - (a, b) => - (b.finishDate == null ? 0 : b.finishDate.getTime()) - - (a.finishDate == null ? 0 : a.finishDate.getTime()), - ); + let _education: any = posMaster.current_holder.profileEducations + .filter(x => x.isEducation == true || x.isUse == true) + .sort( + (a, b) => { + if (a.isEducation !== b.isEducation) { + return a.isEducation ? -1 : 1 + } + return b.level - a.level + } + ); if (_education.length > 0) { - education = _education[0]; + education = _education.map((e:any) => e.degree).join(", ") } } let salary: any = ""; @@ -5429,7 +5457,7 @@ export class ReportController extends Controller { : positionMasterProfileOld.positions.find( (x: any) => x.positionIsSelected == true, )?.posExecutive?.posExecutiveName, - education: education == "" ? "" : education.degree, + education: education == "" ? "" : education, salary: salary == "" ? "" : salary.amount, reason: posMaster.reason, };