diff --git a/src/controllers/KpiUserEvaluationController.ts b/src/controllers/KpiUserEvaluationController.ts index 79fe3b2..b83c9ca 100644 --- a/src/controllers/KpiUserEvaluationController.ts +++ b/src/controllers/KpiUserEvaluationController.ts @@ -248,28 +248,28 @@ export class KpiUserEvaluationController extends Controller { qb.orWhere("kpiUserEvaluation.prefix LIKE :keyword", { keyword: `%${requestBody.keyword}%`, }) - .orWhere("kpiUserEvaluation.firstName LIKE :keyword", { - keyword: `%${requestBody.keyword}%`, - }) - .orWhere("kpiUserEvaluation.lastName LIKE :keyword", { - keyword: `%${requestBody.keyword}%`, - }) - .orWhere("kpiUserEvaluation.org LIKE :keyword", { - keyword: `%${requestBody.keyword}%`, - }) - .orWhere("kpiUserEvaluation.position LIKE :keyword", { - keyword: `%${requestBody.keyword}%`, - }) - .orWhere("kpiUserEvaluation.posTypeName LIKE :keyword", { - keyword: `%${requestBody.keyword}%`, - }) - .orWhere("kpiUserEvaluation.posLevelName LIKE :keyword", { - keyword: `%${requestBody.keyword}%`, - }) - .orWhere(`kpiUserEvaluation.firstName LIKE :firstName`, { - firstName: `%${firstName}%`, - }) - .orWhere(`kpiUserEvaluation.lastName LIKE :lastName`, { lastName: `%${lastName}%` }); + .orWhere("kpiUserEvaluation.firstName LIKE :keyword", { + keyword: `%${requestBody.keyword}%`, + }) + .orWhere("kpiUserEvaluation.lastName LIKE :keyword", { + keyword: `%${requestBody.keyword}%`, + }) + .orWhere("kpiUserEvaluation.org LIKE :keyword", { + keyword: `%${requestBody.keyword}%`, + }) + .orWhere("kpiUserEvaluation.position LIKE :keyword", { + keyword: `%${requestBody.keyword}%`, + }) + .orWhere("kpiUserEvaluation.posTypeName LIKE :keyword", { + keyword: `%${requestBody.keyword}%`, + }) + .orWhere("kpiUserEvaluation.posLevelName LIKE :keyword", { + keyword: `%${requestBody.keyword}%`, + }) + .orWhere(`kpiUserEvaluation.firstName LIKE :firstName`, { + firstName: `%${firstName}%`, + }) + .orWhere(`kpiUserEvaluation.lastName LIKE :lastName`, { lastName: `%${lastName}%` }); }), ) .orderBy("kpiUserEvaluation.createdAt", "ASC") @@ -332,7 +332,7 @@ export class KpiUserEvaluationController extends Controller { "ไม่พบข้อมูลรอบการประเมินผลการปฏิบัติหน้าที่ราชการนี้", ); } - + let isProbation = false; const kpiUserEvaluation = Object.assign(new KpiUserEvaluation(), requestBody); if (requestBody.profileId != undefined && requestBody.profileId != null) { await new CallAPI() @@ -356,6 +356,7 @@ export class KpiUserEvaluationController extends Controller { kpiUserEvaluation.child3Id = x.child3Id; kpiUserEvaluation.child4 = x.child4; kpiUserEvaluation.child4Id = x.child4Id; + isProbation = x.isProbation; }) .catch((x) => { throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลในทะเบียนประวัติ"); @@ -382,6 +383,7 @@ export class KpiUserEvaluationController extends Controller { kpiUserEvaluation.child3Id = x.child3Id; kpiUserEvaluation.child4 = x.child4; kpiUserEvaluation.child4Id = x.child4Id; + isProbation = x.isProbation; }) .catch((x) => { throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลในทะเบียนประวัติ"); @@ -504,7 +506,6 @@ export class KpiUserEvaluationController extends Controller { if (findPosition && findPosition.kpiLinkId && levelForGourp != null) { kpiUserEvaluation.weightPoint1 = 70; kpiUserEvaluation.weightPoint2 = 30; - kpiUserEvaluation.summaryWeight = 100; const findKpiLink = await this.kpiLinkRepository.findOne({ relations: ["kpiCapacitys"], where: { @@ -527,6 +528,10 @@ export class KpiUserEvaluationController extends Controller { } } } + if (isProbation != false) { + kpiUserEvaluation.weightPoint1 = 50; + kpiUserEvaluation.weightPoint2 = 50; + } await this.kpiUserEvalutionRepository.save(kpiUserEvaluation); return new HttpSuccess(kpiUserEvaluation.id);