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, };