add pointSumTotal

This commit is contained in:
AdisakKanthawilang 2024-06-17 17:39:26 +07:00
parent 7351c9b510
commit 063752f002

View file

@ -61,6 +61,7 @@ export class OrganizationUnauthorizeController extends Controller {
.leftJoinAndSelect("positions.posExecutive", "posExecutive")
.leftJoinAndSelect("current_holder.profileSalary", "profileSalary")
.leftJoinAndSelect("current_holder.profileDisciplines", "profileDisciplines")
.leftJoinAndSelect("current_holder.profileAssessments", "profileAssessments")
.leftJoinAndSelect("current_holder.posLevel", "posLevel")
.leftJoinAndSelect("current_holder.posType", "posType")
.where({
@ -188,6 +189,13 @@ export class OrganizationUnauthorizeController extends Controller {
(position) => position.positionIsSelected === true,
);
const isSpecial = specialPosition ? specialPosition.isSpecial : null;
const latestProfileAssessment = item.current_holder.profileAssessments
? item.current_holder.profileAssessments.sort((a:any, b:any) => b.date - a.date)[0]
: null;
const pointSumtotal = latestProfileAssessment
? latestProfileAssessment.pointSumTotal
: null;
return {
id: item.id,
profileId: item.current_holder.id,
@ -216,7 +224,7 @@ export class OrganizationUnauthorizeController extends Controller {
child3: item.orgChild3?.orgChild3Name ? item.orgChild3.orgChild3Name : null,
child4Id: item.orgChild4Id,
child4: item.orgChild4?.orgChild4Name ? item.orgChild4.orgChild4Name : null,
result: null,
result: pointSumtotal,
duration: null,
isPunish:
item.current_holder.profileDisciplines.filter(
@ -279,6 +287,7 @@ export class OrganizationUnauthorizeController extends Controller {
.leftJoinAndSelect("employeePosMaster.positions", "positions")
.leftJoinAndSelect("current_holder.profileSalarys", "profileSalarys")
.leftJoinAndSelect("current_holder.profileDisciplines", "profileDisciplines")
.leftJoinAndSelect("current_holder.profileAssessments", "profileAssessments")
.leftJoinAndSelect("current_holder.posLevel", "posLevel")
.leftJoinAndSelect("current_holder.posType", "posType")
.where({
@ -392,7 +401,10 @@ export class OrganizationUnauthorizeController extends Controller {
datePeriodStart.getMonth() - 6,
),
);
const latestProfileAssessment = item.current_holder.profileAssessments
? item.current_holder.profileAssessments.sort((a: any, b: any) => b.date - a.date)[0]
: null;
const pointSumtotal = latestProfileAssessment ? latestProfileAssessment.pointSumTotal : null;
return {
profileId: item.current_holder.id,
salaryLevel: item.current_holder.salaryLevel,
@ -423,7 +435,7 @@ export class OrganizationUnauthorizeController extends Controller {
child3: item.orgChild3?.orgChild3Name ? item.orgChild3.orgChild3Name : null,
child4Id: item.orgChild4Id,
child4: item.orgChild4?.orgChild4Name ? item.orgChild4.orgChild4Name : null,
result: null,
result: pointSumtotal,
duration: null,
isPunish:
item.current_holder.profileDisciplines.filter(