From fb7cce3a060cb27bdf88a4c465d6e0a14ff6df18 Mon Sep 17 00:00:00 2001 From: AdisakKanthawilang Date: Mon, 17 Feb 2025 17:46:29 +0700 Subject: [PATCH] convert point --- .../OrganizationUnauthorizeController.ts | 21 ++++++++++--------- src/interfaces/extension.ts | 10 +++++++++ 2 files changed, 21 insertions(+), 10 deletions(-) diff --git a/src/controllers/OrganizationUnauthorizeController.ts b/src/controllers/OrganizationUnauthorizeController.ts index c73d2f23..72858648 100644 --- a/src/controllers/OrganizationUnauthorizeController.ts +++ b/src/controllers/OrganizationUnauthorizeController.ts @@ -17,6 +17,7 @@ import { log } from "console"; import { format } from "path"; import { viewProfileEvaluation } from "../entities/view/viewProfileEvaluation"; import { viewProfileEmployeeEvaluation } from "../entities/view/viewProfileEmployeeEvaluation"; +import Extension from "../interfaces/extension"; @Route("api/v1/org/unauthorize") @Tags("OrganizationUnauthorize") @@ -1247,34 +1248,34 @@ export class OrganizationUnauthorizeController extends Controller { profileId: x.profileId, yearAPR1: x.yearAPR1, periodAPR1: x.periodAPR1, - resultAPR1: x.resultAPR1, + resultAPR1: x.resultAPR1?Extension.textPoint(x.resultAPR1):"-", yearOCT1: x.yearOCT1, periodOCT1: x.periodOCT1, - resultOCT1: x.resultOCT1, + resultOCT1: x.resultOCT1?Extension.textPoint(x.resultOCT1):"-", yearAPR2: x.yearAPR2, periodAPR2: x.periodAPR2, - resultAPR2: x.resultAPR2, + resultAPR2: x.resultAPR2?Extension.textPoint(x.resultAPR2):"-", yearOCT2: x.yearOCT2, periodOCT2: x.periodOCT2, - resultOCT2: x.resultOCT2, + resultOCT2: x.resultOCT2?Extension.textPoint(x.resultOCT2):"-", yearAPR3: x.yearAPR3, periodAPR3: x.periodAPR3, - resultAPR3: x.resultAPR3, + resultAPR3: x.resultAPR3?Extension.textPoint(x.resultAPR3):"-", yearOCT3: x.yearOCT3, periodOCT3: x.periodOCT3, - resultOCT3: x.resultOCT3, + resultOCT3: x.resultOCT3?Extension.textPoint(x.resultOCT3):"-", yearAPR4: x.yearAPR4, periodAPR4: x.periodAPR4, - resultAPR4: x.resultAPR4, + resultAPR4: x.resultAPR4?Extension.textPoint(x.resultAPR4):"-", yearOCT4: x.yearOCT4, periodOCT4: x.periodOCT4, - resultOCT4: x.resultOCT4, + resultOCT4: x.resultOCT4?Extension.textPoint(x.resultOCT4):"-", yearAPR5: x.yearAPR5, periodAPR5: x.periodAPR5, - resultAPR5: x.resultAPR5, + resultAPR5: x.resultAPR5?Extension.textPoint(x.resultAPR5):"-", yearOCT5: x.yearOCT5, periodOCT5: x.periodOCT5, - resultOCT5: x.resultOCT5, + resultOCT5: x.resultOCT5?Extension.textPoint(x.resultOCT5):"-", })); return new HttpSuccess(formattedResults); diff --git a/src/interfaces/extension.ts b/src/interfaces/extension.ts index 5856f98e..a2e766dc 100644 --- a/src/interfaces/extension.ts +++ b/src/interfaces/extension.ts @@ -367,6 +367,16 @@ class Extension { const deleteKey = delAsync(type + id); return; } + + public static textPoint(val: number | undefined) { + if (val == undefined) val = -1; + if (val >= 0 && val <= 60) return "ต้องปรับปรุง"; + if (val >= 60 && val <= 69) return "พอใช้"; + if (val >= 70 && val <= 79) return "ดี"; + if (val >= 80 && val <= 89) return "ดีมาก"; + if (val >= 90 && val <= 100) return "ดีเด่น"; + else return "-"; + } } export default Extension;