From 92f3c3413ff8ddc0791d809367bd76c6cfa044dd Mon Sep 17 00:00:00 2001 From: Kittapath Date: Thu, 27 Jun 2024 16:58:59 +0700 Subject: [PATCH] save waith --- src/controllers/KpiReasonController.ts | 32 +++++++------------ .../KpiUserEvaluationController.ts | 1 + 2 files changed, 13 insertions(+), 20 deletions(-) diff --git a/src/controllers/KpiReasonController.ts b/src/controllers/KpiReasonController.ts index 26332f7..80e5295 100644 --- a/src/controllers/KpiReasonController.ts +++ b/src/controllers/KpiReasonController.ts @@ -80,7 +80,7 @@ export class kpiReasonController extends Controller { let kpiUserEvaluationReason = Object.assign(new KpiUserEvaluationReasonPlan(), requestBody); kpiUserEvaluationReason.type = type.trim().toUpperCase(); - if (type.trim().toUpperCase() == "PROGRESS") { + if (type.trim().toUpperCase() == "PROBLEM") { const _kpiUserEvaluationReason = await this.kpiUserEvaluationReasonPlan.findOne({ where: { id: id }, relations: ["kpiUserPlanned", "kpiUserPlanned.kpiUserEvaluation"], @@ -203,7 +203,7 @@ export class kpiReasonController extends Controller { */ @Get("{type}/plan/{user}/{id}") async listKpiUserPlanReason(@Path() id: string, @Path() type: string, @Path() user: string) { - if (type.trim().toUpperCase() == "PROGRESS") { + if (type.trim().toUpperCase() == "PROBLEM") { const kpiUserEvaluationReason = await this.kpiUserEvaluationReasonPlan.find({ where: { kpiUserPlannedId: id, type: type.trim().toUpperCase() }, }); @@ -267,7 +267,7 @@ export class kpiReasonController extends Controller { }); let kpiUserEvaluationReason = Object.assign(new KpiUserEvaluationReasonRole(), requestBody); kpiUserEvaluationReason.type = type.trim().toUpperCase(); - if (type.trim().toUpperCase() == "PROGRESS") { + if (type.trim().toUpperCase() == "PROBLEM") { const _kpiUserEvaluationReason = await this.kpiUserEvaluationReasonRole.findOne({ where: { id: id }, relations: ["kpiUserRole", "kpiUserRole.kpiUserEvaluation"], @@ -391,7 +391,7 @@ export class kpiReasonController extends Controller { */ @Get("{type}/role/{user}/{id}") async listKpiUserRoleReason(@Path() id: string, @Path() type: string, @Path() user: string) { - if (type.trim().toUpperCase() == "PROGRESS") { + if (type.trim().toUpperCase() == "PROBLEM") { const kpiUserEvaluationReason = await this.kpiUserEvaluationReasonRole.find({ where: { kpiUserRoleId: id, type: type.trim().toUpperCase() }, }); @@ -458,7 +458,7 @@ export class kpiReasonController extends Controller { requestBody, ); kpiUserEvaluationReason.type = type.trim().toUpperCase(); - if (type.trim().toUpperCase() == "PROGRESS") { + if (type.trim().toUpperCase() == "PROBLEM") { const _kpiUserEvaluationReason = await this.kpiUserEvaluationReasonSpecial.findOne({ where: { id: id }, relations: ["kpiUserSpecial", "kpiUserSpecial.kpiUserEvaluation"], @@ -581,7 +581,7 @@ export class kpiReasonController extends Controller { */ @Get("{type}/special/{user}/{id}") async listKpiUserSpecialReason(@Path() id: string, @Path() type: string, @Path() user: string) { - if (type.trim().toUpperCase() == "PROGRESS") { + if (type.trim().toUpperCase() == "PROBLEM") { const kpiUserEvaluationReason = await this.kpiUserEvaluationReasonSpecial.find({ where: { kpiUserSpecialId: id, type: type.trim().toUpperCase() }, }); @@ -648,7 +648,7 @@ export class kpiReasonController extends Controller { requestBody, ); kpiUserEvaluationReason.type = type.trim().toUpperCase(); - if (type.trim().toUpperCase() == "PROGRESS") { + if (type.trim().toUpperCase() == "PROBLEM") { const _kpiUserEvaluationReason = await this.kpiUserEvaluationReasonDevelopment.findOne({ where: { id: id }, relations: ["kpiUserDevelopment", "kpiUserDevelopment.kpiUserEvaluation"], @@ -676,11 +676,7 @@ export class kpiReasonController extends Controller { "ไม่พบข้อมูลรายการประเมินผลการปฏิบัติราชการระดับบุคคลนี้", ); } - kpiUserEvaluationReason.status = - kpiUserEvaluation.kpiUserEvaluation.evaluatorId == null || - kpiUserEvaluation.kpiUserEvaluation.evaluatorId == "" - ? "DONE" - : "EVALUATOR"; + kpiUserEvaluationReason.status = "DONE"; } kpiUserEvaluationReason.kpiUserDevelopmentId = id; kpiUserEvaluationReason.createdUserId = request.user.sub; @@ -775,7 +771,7 @@ export class kpiReasonController extends Controller { @Path() type: string, @Path() user: string, ) { - if (type.trim().toUpperCase() == "PROGRESS") { + if (type.trim().toUpperCase() == "PROBLEM") { const kpiUserEvaluationReason = await this.kpiUserEvaluationReasonDevelopment.find({ where: { kpiUserDevelopmentId: id, type: type.trim().toUpperCase() }, }); @@ -842,7 +838,7 @@ export class kpiReasonController extends Controller { requestBody, ); kpiUserEvaluationReason.type = type.trim().toUpperCase(); - if (type.trim().toUpperCase() == "PROGRESS") { + if (type.trim().toUpperCase() == "PROBLEM") { const _kpiUserEvaluationReason = await this.kpiUserEvaluationReasonCapacity.findOne({ where: { id: id }, relations: ["kpiUserCapacity", "kpiUserCapacity.kpiUserEvaluation"], @@ -870,11 +866,7 @@ export class kpiReasonController extends Controller { "ไม่พบข้อมูลรายการประเมินผลการปฏิบัติราชการระดับบุคคลนี้", ); } - kpiUserEvaluationReason.status = - kpiUserEvaluation.kpiUserEvaluation.evaluatorId == null || - kpiUserEvaluation.kpiUserEvaluation.evaluatorId == "" - ? "DONE" - : "EVALUATOR"; + kpiUserEvaluationReason.status = "DONE"; } kpiUserEvaluationReason.kpiUserCapacityId = id; kpiUserEvaluationReason.createdUserId = request.user.sub; @@ -965,7 +957,7 @@ export class kpiReasonController extends Controller { */ @Get("{type}/capacity/{user}/{id}") async listKpiUserCapacityReason(@Path() id: string, @Path() type: string, @Path() user: string) { - if (type.trim().toUpperCase() == "PROGRESS") { + if (type.trim().toUpperCase() == "PROBLEM") { const kpiUserEvaluationReason = await this.kpiUserEvaluationReasonCapacity.find({ where: { kpiUserCapacityId: id, type: type.trim().toUpperCase() }, }); diff --git a/src/controllers/KpiUserEvaluationController.ts b/src/controllers/KpiUserEvaluationController.ts index c3c182c..6a4b812 100644 --- a/src/controllers/KpiUserEvaluationController.ts +++ b/src/controllers/KpiUserEvaluationController.ts @@ -449,6 +449,7 @@ export class KpiUserEvaluationController extends Controller { } } } + await this.kpiUserEvalutionRepository.save(kpiUserEvaluation); return new HttpSuccess(kpiUserEvaluation.id); }