เหตุผล kpi

This commit is contained in:
Kittapath 2024-06-26 23:27:33 +07:00
parent ae87b678d1
commit 047ebd5bb1
5 changed files with 196 additions and 28 deletions

View file

@ -80,7 +80,7 @@ export class kpiReasonController extends Controller {
let kpiUserEvaluationReason = Object.assign(new KpiUserEvaluationReasonPlan(), requestBody); let kpiUserEvaluationReason = Object.assign(new KpiUserEvaluationReasonPlan(), requestBody);
kpiUserEvaluationReason.type = type.trim().toUpperCase(); kpiUserEvaluationReason.type = type.trim().toUpperCase();
if (type.trim().toUpperCase() == "PROBLEM") { if (type.trim().toUpperCase() == "PROGRESS") {
const _kpiUserEvaluationReason = await this.kpiUserEvaluationReasonPlan.findOne({ const _kpiUserEvaluationReason = await this.kpiUserEvaluationReasonPlan.findOne({
where: { id: id }, where: { id: id },
relations: ["kpiUserPlanned", "kpiUserPlanned.kpiUserEvaluation"], relations: ["kpiUserPlanned", "kpiUserPlanned.kpiUserEvaluation"],
@ -267,7 +267,7 @@ export class kpiReasonController extends Controller {
}); });
let kpiUserEvaluationReason = Object.assign(new KpiUserEvaluationReasonRole(), requestBody); let kpiUserEvaluationReason = Object.assign(new KpiUserEvaluationReasonRole(), requestBody);
kpiUserEvaluationReason.type = type.trim().toUpperCase(); kpiUserEvaluationReason.type = type.trim().toUpperCase();
if (type.trim().toUpperCase() == "PROBLEM") { if (type.trim().toUpperCase() == "PROGRESS") {
const _kpiUserEvaluationReason = await this.kpiUserEvaluationReasonRole.findOne({ const _kpiUserEvaluationReason = await this.kpiUserEvaluationReasonRole.findOne({
where: { id: id }, where: { id: id },
relations: ["kpiUserRole", "kpiUserRole.kpiUserEvaluation"], relations: ["kpiUserRole", "kpiUserRole.kpiUserEvaluation"],
@ -458,7 +458,7 @@ export class kpiReasonController extends Controller {
requestBody, requestBody,
); );
kpiUserEvaluationReason.type = type.trim().toUpperCase(); kpiUserEvaluationReason.type = type.trim().toUpperCase();
if (type.trim().toUpperCase() == "PROBLEM") { if (type.trim().toUpperCase() == "PROGRESS") {
const _kpiUserEvaluationReason = await this.kpiUserEvaluationReasonSpecial.findOne({ const _kpiUserEvaluationReason = await this.kpiUserEvaluationReasonSpecial.findOne({
where: { id: id }, where: { id: id },
relations: ["kpiUserSpecial", "kpiUserSpecial.kpiUserEvaluation"], relations: ["kpiUserSpecial", "kpiUserSpecial.kpiUserEvaluation"],
@ -648,7 +648,7 @@ export class kpiReasonController extends Controller {
requestBody, requestBody,
); );
kpiUserEvaluationReason.type = type.trim().toUpperCase(); kpiUserEvaluationReason.type = type.trim().toUpperCase();
if (type.trim().toUpperCase() == "PROBLEM") { if (type.trim().toUpperCase() == "PROGRESS") {
const _kpiUserEvaluationReason = await this.kpiUserEvaluationReasonDevelopment.findOne({ const _kpiUserEvaluationReason = await this.kpiUserEvaluationReasonDevelopment.findOne({
where: { id: id }, where: { id: id },
relations: ["kpiUserDevelopment", "kpiUserDevelopment.kpiUserEvaluation"], relations: ["kpiUserDevelopment", "kpiUserDevelopment.kpiUserEvaluation"],
@ -842,7 +842,7 @@ export class kpiReasonController extends Controller {
requestBody, requestBody,
); );
kpiUserEvaluationReason.type = type.trim().toUpperCase(); kpiUserEvaluationReason.type = type.trim().toUpperCase();
if (type.trim().toUpperCase() == "PROBLEM") { if (type.trim().toUpperCase() == "PROGRESS") {
const _kpiUserEvaluationReason = await this.kpiUserEvaluationReasonCapacity.findOne({ const _kpiUserEvaluationReason = await this.kpiUserEvaluationReasonCapacity.findOne({
where: { id: id }, where: { id: id },
relations: ["kpiUserCapacity", "kpiUserCapacity.kpiUserEvaluation"], relations: ["kpiUserCapacity", "kpiUserCapacity.kpiUserEvaluation"],

View file

@ -100,19 +100,24 @@ export class KpiUserEvaluationController extends Controller {
requestBody.status != null && requestBody.status != undefined requestBody.status != null && requestBody.status != undefined
? requestBody.status.trim().toUpperCase() == "NEW" ? requestBody.status.trim().toUpperCase() == "NEW"
? `evaluationStatus LIKE CASE WHEN evaluatorId = "${profileId}" THEN "NEW_EVALUATOR" WHEN commanderId = "${profileId}" THEN "NEW_COMMANDER" WHEN commanderHighId = "${profileId}" THEN "NEW_COMMANDER_HIGH" ELSE "${requestBody.status.trim().toUpperCase()}" END` ? `evaluationStatus LIKE CASE WHEN evaluatorId = "${profileId}" THEN "NEW_EVALUATOR" WHEN commanderId = "${profileId}" THEN "NEW_COMMANDER" WHEN commanderHighId = "${profileId}" THEN "NEW_COMMANDER_HIGH" ELSE "${requestBody.status.trim().toUpperCase()}" END`
: requestBody.status.trim().toUpperCase() == "EVALUATING_EVALUATOR" : requestBody.status.trim().toUpperCase() == "EVALUATING_EVALUATOR" ||
? requestBody.evaluating == null || requestBody.evaluating == undefined requestBody.status.trim().toUpperCase() == "EVALUATING"
? `evaluationStatus LIKE CASE WHEN evaluatorId = "${profileId}" THEN "EVALUATING_EVALUATOR" WHEN commanderId = "${profileId}" THEN "EVALUATING_COMMANDER" WHEN commanderHighId = "${profileId}" THEN "EVALUATING_COMMANDER_HIGH" ELSE "${requestBody.status.trim().toUpperCase()}" END` ? "evaluationStatus LIKE :status"
: requestBody.evaluating == true : requestBody.status.trim().toUpperCase() == "SUMMARY"
? `evaluationStatus LIKE CASE WHEN evaluatorId = "${profileId}" THEN "EVALUATING_EVALUATOR" ELSE "${requestBody.status.trim().toUpperCase()}" END` ? "evaluationStatus LIKE :status"
: `evaluationStatus LIKE CASE WHEN commanderId = "${profileId}" THEN "EVALUATING_COMMANDER" WHEN commanderHighId = "${profileId}" THEN "EVALUATING_COMMANDER_HIGH" ELSE "${requestBody.status.trim().toUpperCase()}" END` : "evaluationStatus LIKE :status"
: "evaluationStatus LIKE :status"
: "1=1", : "1=1",
{ {
status: status:
requestBody.status == null || requestBody.status == undefined requestBody.status == null || requestBody.status == undefined
? null ? null
: requestBody.status.trim().toUpperCase(), : requestBody.status.trim().toUpperCase() == "EVALUATING" ||
requestBody.status.trim().toUpperCase() == "EVALUATING_EVALUATOR" ||
requestBody.status.trim().toUpperCase() == "SUMMARY"
? requestBody.status.trim().toUpperCase() == "SUMMARY"
? `%${requestBody.status.trim().toUpperCase()}%`
: `%EVALUATING%`
: requestBody.status.trim().toUpperCase(),
}, },
) )
.andWhere( .andWhere(
@ -415,7 +420,13 @@ export class KpiUserEvaluationController extends Controller {
levelForGourp = "2"; levelForGourp = "2";
if (kpiUserEvaluation.posTypeName == "ทั่วไป" && kpiUserEvaluation.posLevelName == "ปฏิบัติงาน") if (kpiUserEvaluation.posTypeName == "ทั่วไป" && kpiUserEvaluation.posLevelName == "ปฏิบัติงาน")
levelForGourp = "1"; levelForGourp = "1";
kpiUserEvaluation.weightPoint1 = 80;
kpiUserEvaluation.weightPoint2 = 20;
kpiUserEvaluation.summaryWeight = 100;
if (findPosition && findPosition.kpiLinkId && levelForGourp != null) { if (findPosition && findPosition.kpiLinkId && levelForGourp != null) {
kpiUserEvaluation.weightPoint1 = 70;
kpiUserEvaluation.weightPoint2 = 30;
kpiUserEvaluation.summaryWeight = 100;
const findKpiLink = await this.kpiLinkRepository.findOne({ const findKpiLink = await this.kpiLinkRepository.findOne({
relations: ["kpiCapacitys"], relations: ["kpiCapacitys"],
where: { where: {
@ -493,6 +504,22 @@ export class KpiUserEvaluationController extends Controller {
"ไม่พบข้อมูลรายการประเมินผลการปฏิบัติราชการระดับบุคคลนี้", "ไม่พบข้อมูลรายการประเมินผลการปฏิบัติราชการระดับบุคคลนี้",
); );
} }
if (requestBody.summaryPoint != null) {
if (requestBody.summaryPoint >= 90) {
kpiUserEvaluation.evaluationResults = "EXCELLENT";
} else if (requestBody.summaryPoint >= 80) {
kpiUserEvaluation.evaluationResults = "VERY_GOOD";
} else if (requestBody.summaryPoint >= 70) {
kpiUserEvaluation.evaluationResults = "GOOD";
} else if (requestBody.summaryPoint >= 60) {
kpiUserEvaluation.evaluationResults = "FAIR";
} else {
kpiUserEvaluation.evaluationResults = "IMPROVEMENT";
}
} else {
kpiUserEvaluation.evaluationResults = "IMPROVEMENT";
}
kpiUserEvaluation.lastUpdateUserId = request.user.sub; kpiUserEvaluation.lastUpdateUserId = request.user.sub;
kpiUserEvaluation.lastUpdateFullName = request.user.name; kpiUserEvaluation.lastUpdateFullName = request.user.name;
Object.assign(kpiUserEvaluation, requestBody); Object.assign(kpiUserEvaluation, requestBody);
@ -663,11 +690,15 @@ export class KpiUserEvaluationController extends Controller {
evaluatorId: kpiUserEvaluation.evaluatorId, evaluatorId: kpiUserEvaluation.evaluatorId,
commanderId: kpiUserEvaluation.commanderId, commanderId: kpiUserEvaluation.commanderId,
commanderHighId: kpiUserEvaluation.commanderHighId, commanderHighId: kpiUserEvaluation.commanderHighId,
plannedPoint: kpiUserEvaluation.plannedPoint, // plannedPoint: kpiUserEvaluation.plannedPoint,
rolePoint: kpiUserEvaluation.rolePoint, // rolePoint: kpiUserEvaluation.rolePoint,
specialPoint: kpiUserEvaluation.specialPoint, // specialPoint: kpiUserEvaluation.specialPoint,
capacityPoint: kpiUserEvaluation.capacityPoint, // capacityPoint: kpiUserEvaluation.capacityPoint,
kpiPeriodId: kpiUserEvaluation.kpiPeriodId, kpiPeriodId: kpiUserEvaluation.kpiPeriodId,
totalPoint1: kpiUserEvaluation.totalPoint1,
totalPoint2_1: kpiUserEvaluation.totalPoint2_1,
totalPoint2_2: kpiUserEvaluation.totalPoint2_2,
summaryPoint: kpiUserEvaluation.summaryPoint,
year: kpiUserEvaluation.kpiPeriod == null ? null : kpiUserEvaluation.kpiPeriod.year, year: kpiUserEvaluation.kpiPeriod == null ? null : kpiUserEvaluation.kpiPeriod.year,
durationKPI: durationKPI:
kpiUserEvaluation.kpiPeriod == null ? null : kpiUserEvaluation.kpiPeriod.durationKPI, kpiUserEvaluation.kpiPeriod == null ? null : kpiUserEvaluation.kpiPeriod.durationKPI,
@ -960,7 +991,7 @@ export class KpiUserEvaluationController extends Controller {
if (role == "EVALUATOR") { if (role == "EVALUATOR") {
if (item.evaluationStatus == "EVALUATING_EVALUATOR") { if (item.evaluationStatus == "EVALUATING_EVALUATOR") {
if (item.commanderId == null || item.commanderId == "") { if (item.commanderId == null || item.commanderId == "") {
item.evaluationStatus = "COMPLETE"; item.evaluationStatus = "SUMMARY";
} else { } else {
item.evaluationStatus = "EVALUATING_COMMANDER"; item.evaluationStatus = "EVALUATING_COMMANDER";
} }
@ -969,13 +1000,13 @@ export class KpiUserEvaluationController extends Controller {
} else if (role == "COMMANDER") { } else if (role == "COMMANDER") {
if (item.evaluationStatus == "EVALUATING_COMMANDER") { if (item.evaluationStatus == "EVALUATING_COMMANDER") {
if (item.commanderHighId == null || item.commanderHighId == "") { if (item.commanderHighId == null || item.commanderHighId == "") {
item.evaluationStatus = "COMPLETE"; item.evaluationStatus = "SUMMARY";
} else { } else {
item.evaluationStatus = "EVALUATING_COMMANDER_HIGH"; item.evaluationStatus = "EVALUATING_COMMANDER_HIGH";
} }
} }
} else { } else {
item.evaluationStatus = "COMPLETE"; item.evaluationStatus = "SUMMARY";
} }
// } else { // } else {
// // item.evaluationStatus = requestBody.status.trim().toUpperCase(); // // item.evaluationStatus = requestBody.status.trim().toUpperCase();
@ -1043,6 +1074,24 @@ export class KpiUserEvaluationController extends Controller {
); );
} }
const _null: any = null; const _null: any = null;
if (kpiUserEvaluation.commanderId == null) {
kpiUserEvaluation.evaluationStatus = "COMPLETE";
await new CallAPI()
.PostData(request, "org/profile/assessments", {
date: new Date(),
name: null,
point1: null,
point1Total: kpiUserEvaluation.totalPoint1,
point2: null,
point2Total: kpiUserEvaluation.totalPoint2_1 + kpiUserEvaluation.totalPoint2_2,
pointSum: null,
pointSumTotal: kpiUserEvaluation.summaryPoint,
profileId: kpiUserEvaluation.profileId,
})
.then(async (x) => {});
} else {
kpiUserEvaluation.evaluationStatus = "SUMMARY_COMMANDER";
}
kpiUserEvaluation.topicEvaluator = kpiUserEvaluation.topicEvaluator =
requestBody.topicEvaluator == null ? _null : requestBody.topicEvaluator; requestBody.topicEvaluator == null ? _null : requestBody.topicEvaluator;
kpiUserEvaluation.developEvaluator = kpiUserEvaluation.developEvaluator =
@ -1084,6 +1133,24 @@ export class KpiUserEvaluationController extends Controller {
); );
} }
const _null: any = null; const _null: any = null;
if (kpiUserEvaluation.commanderHighId == null) {
kpiUserEvaluation.evaluationStatus = "COMPLETE";
await new CallAPI()
.PostData(request, "org/profile/assessments", {
date: new Date(),
name: null,
point1: null,
point1Total: kpiUserEvaluation.totalPoint1,
point2: null,
point2Total: kpiUserEvaluation.totalPoint2_1 + kpiUserEvaluation.totalPoint2_2,
pointSum: null,
pointSumTotal: kpiUserEvaluation.summaryPoint,
profileId: kpiUserEvaluation.profileId,
})
.then(async (x) => {});
} else {
kpiUserEvaluation.evaluationStatus = "SUMMARY_COMMANDER_HIGH";
}
kpiUserEvaluation.isReasonCommander = requestBody.isReason; kpiUserEvaluation.isReasonCommander = requestBody.isReason;
kpiUserEvaluation.reasonCommander = requestBody.reason == null ? _null : requestBody.reason; kpiUserEvaluation.reasonCommander = requestBody.reason == null ? _null : requestBody.reason;
kpiUserEvaluation.lastUpdateUserId = request.user.sub; kpiUserEvaluation.lastUpdateUserId = request.user.sub;
@ -1119,6 +1186,20 @@ export class KpiUserEvaluationController extends Controller {
); );
} }
const _null: any = null; const _null: any = null;
kpiUserEvaluation.evaluationStatus = "COMPLETE";
await new CallAPI()
.PostData(request, "org/profile/assessments", {
date: new Date(),
name: null,
point1: null,
point1Total: kpiUserEvaluation.totalPoint1,
point2: null,
point2Total: kpiUserEvaluation.totalPoint2_1 + kpiUserEvaluation.totalPoint2_2,
pointSum: null,
pointSumTotal: kpiUserEvaluation.summaryPoint,
profileId: kpiUserEvaluation.profileId,
})
.then(async (x) => {});
kpiUserEvaluation.isReasonCommanderHigh = requestBody.isReason; kpiUserEvaluation.isReasonCommanderHigh = requestBody.isReason;
kpiUserEvaluation.reasonCommanderHigh = requestBody.reason == null ? _null : requestBody.reason; kpiUserEvaluation.reasonCommanderHigh = requestBody.reason == null ? _null : requestBody.reason;
kpiUserEvaluation.lastUpdateUserId = request.user.sub; kpiUserEvaluation.lastUpdateUserId = request.user.sub;
@ -1150,6 +1231,23 @@ export class KpiUserEvaluationController extends Controller {
"reasonCommander", "reasonCommander",
"isReasonCommanderHigh", "isReasonCommanderHigh",
"reasonCommanderHigh", "reasonCommanderHigh",
"plannedPoint",
"rolePoint",
"specialPoint",
"capacityPoint",
"totalPoint1",
"totalPoint2_1",
"totalPoint2_2",
"summaryPoint",
"weightPoint1",
"weightPoint2",
"summaryWeight",
"evaluationResults",
"isOpen", "isOpen",
], ],
}); });

View file

@ -127,7 +127,7 @@ export class KpiUserEvaluation extends EntityBase {
@Column({ @Column({
type: "double", type: "double",
nullable: true, nullable: true,
default: null, default: 0,
comment: "งานตามแผนปฏิบัติราชการประจำปี ร้อยละ", comment: "งานตามแผนปฏิบัติราชการประจำปี ร้อยละ",
}) })
plannedPoint: number; plannedPoint: number;
@ -135,7 +135,7 @@ export class KpiUserEvaluation extends EntityBase {
@Column({ @Column({
type: "double", type: "double",
nullable: true, nullable: true,
default: null, default: 0,
comment: "งานตามหน้าที่ความรับผิดชอบหลัก ร้อยละ", comment: "งานตามหน้าที่ความรับผิดชอบหลัก ร้อยละ",
}) })
rolePoint: number; rolePoint: number;
@ -143,7 +143,7 @@ export class KpiUserEvaluation extends EntityBase {
@Column({ @Column({
type: "double", type: "double",
nullable: true, nullable: true,
default: null, default: 0,
comment: "งานที่ได้รับมอบหมายพิเศษ ร้อยละ", comment: "งานที่ได้รับมอบหมายพิเศษ ร้อยละ",
}) })
specialPoint: number; specialPoint: number;
@ -151,7 +151,7 @@ export class KpiUserEvaluation extends EntityBase {
@Column({ @Column({
type: "double", type: "double",
nullable: true, nullable: true,
default: null, default: 0,
comment: "สมรรถนะ ร้อยละ", comment: "สมรรถนะ ร้อยละ",
}) })
capacityPoint: number; capacityPoint: number;
@ -159,7 +159,7 @@ export class KpiUserEvaluation extends EntityBase {
@Column({ @Column({
type: "double", type: "double",
nullable: true, nullable: true,
default: null, default: 0,
comment: "คะแนนประเมินองค์ประกอบที่ 1", comment: "คะแนนประเมินองค์ประกอบที่ 1",
}) })
totalPoint1: number; totalPoint1: number;
@ -167,7 +167,7 @@ export class KpiUserEvaluation extends EntityBase {
@Column({ @Column({
type: "double", type: "double",
nullable: true, nullable: true,
default: null, default: 0,
comment: "คะแนนประเมินองค์ประกอบที่ 2.1", comment: "คะแนนประเมินองค์ประกอบที่ 2.1",
}) })
totalPoint2_1: number; totalPoint2_1: number;
@ -175,7 +175,7 @@ export class KpiUserEvaluation extends EntityBase {
@Column({ @Column({
type: "double", type: "double",
nullable: true, nullable: true,
default: null, default: 0,
comment: "คะแนนประเมินองค์ประกอบที่ 2.2", comment: "คะแนนประเมินองค์ประกอบที่ 2.2",
}) })
totalPoint2_2: number; totalPoint2_2: number;
@ -183,11 +183,35 @@ export class KpiUserEvaluation extends EntityBase {
@Column({ @Column({
type: "double", type: "double",
nullable: true, nullable: true,
default: null, default: 0,
comment: "คะแนนประเมิน", comment: "คะแนนประเมิน",
}) })
summaryPoint: number; summaryPoint: number;
@Column({
type: "double",
nullable: true,
default: 0,
comment: "คะแนนประเมินองค์ประกอบที่ 1",
})
weightPoint1: number;
@Column({
type: "double",
nullable: true,
default: 0,
comment: "คะแนนประเมินองค์ประกอบที่ 2",
})
weightPoint2: number;
@Column({
type: "double",
nullable: true,
default: 0,
comment: "คะแนนประเมิน",
})
summaryWeight: number;
@Column({ @Column({
nullable: true, nullable: true,
comment: "ชื่อเรื่อง/เนื้อหา/หัวข้อการพัฒนา", comment: "ชื่อเรื่อง/เนื้อหา/หัวข้อการพัฒนา",

View file

@ -0,0 +1,28 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class UpdateTableSummaryPoint01719393220115 implements MigrationInterface {
name = 'UpdateTableSummaryPoint01719393220115'
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`kpiUserEvaluation\` CHANGE \`plannedPoint\` \`plannedPoint\` double NULL COMMENT 'งานตามแผนปฏิบัติราชการประจำปี ร้อยละ' DEFAULT '0'`);
await queryRunner.query(`ALTER TABLE \`kpiUserEvaluation\` CHANGE \`rolePoint\` \`rolePoint\` double NULL COMMENT 'งานตามหน้าที่ความรับผิดชอบหลัก ร้อยละ' DEFAULT '0'`);
await queryRunner.query(`ALTER TABLE \`kpiUserEvaluation\` CHANGE \`specialPoint\` \`specialPoint\` double NULL COMMENT 'งานที่ได้รับมอบหมายพิเศษ ร้อยละ' DEFAULT '0'`);
await queryRunner.query(`ALTER TABLE \`kpiUserEvaluation\` CHANGE \`capacityPoint\` \`capacityPoint\` double NULL COMMENT 'สมรรถนะ ร้อยละ' DEFAULT '0'`);
await queryRunner.query(`ALTER TABLE \`kpiUserEvaluation\` CHANGE \`totalPoint1\` \`totalPoint1\` double NULL COMMENT 'คะแนนประเมินองค์ประกอบที่ 1' DEFAULT '0'`);
await queryRunner.query(`ALTER TABLE \`kpiUserEvaluation\` CHANGE \`totalPoint2_1\` \`totalPoint2_1\` double NULL COMMENT 'คะแนนประเมินองค์ประกอบที่ 2.1' DEFAULT '0'`);
await queryRunner.query(`ALTER TABLE \`kpiUserEvaluation\` CHANGE \`totalPoint2_2\` \`totalPoint2_2\` double NULL COMMENT 'คะแนนประเมินองค์ประกอบที่ 2.2' DEFAULT '0'`);
await queryRunner.query(`ALTER TABLE \`kpiUserEvaluation\` CHANGE \`summaryPoint\` \`summaryPoint\` double NULL COMMENT 'คะแนนประเมิน' DEFAULT '0'`);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`kpiUserEvaluation\` CHANGE \`summaryPoint\` \`summaryPoint\` double NULL COMMENT 'คะแนนประเมิน'`);
await queryRunner.query(`ALTER TABLE \`kpiUserEvaluation\` CHANGE \`totalPoint2_2\` \`totalPoint2_2\` double NULL COMMENT 'คะแนนประเมินองค์ประกอบที่ 2.2'`);
await queryRunner.query(`ALTER TABLE \`kpiUserEvaluation\` CHANGE \`totalPoint2_1\` \`totalPoint2_1\` double NULL COMMENT 'คะแนนประเมินองค์ประกอบที่ 2.1'`);
await queryRunner.query(`ALTER TABLE \`kpiUserEvaluation\` CHANGE \`totalPoint1\` \`totalPoint1\` double NULL COMMENT 'คะแนนประเมินองค์ประกอบที่ 1'`);
await queryRunner.query(`ALTER TABLE \`kpiUserEvaluation\` CHANGE \`capacityPoint\` \`capacityPoint\` double NULL COMMENT 'สมรรถนะ ร้อยละ'`);
await queryRunner.query(`ALTER TABLE \`kpiUserEvaluation\` CHANGE \`specialPoint\` \`specialPoint\` double NULL COMMENT 'งานที่ได้รับมอบหมายพิเศษ ร้อยละ'`);
await queryRunner.query(`ALTER TABLE \`kpiUserEvaluation\` CHANGE \`rolePoint\` \`rolePoint\` double NULL COMMENT 'งานตามหน้าที่ความรับผิดชอบหลัก ร้อยละ'`);
await queryRunner.query(`ALTER TABLE \`kpiUserEvaluation\` CHANGE \`plannedPoint\` \`plannedPoint\` double NULL COMMENT 'งานตามแผนปฏิบัติราชการประจำปี ร้อยละ'`);
}
}

View file

@ -0,0 +1,18 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class UpdateTableSummaryWeight1719398567558 implements MigrationInterface {
name = 'UpdateTableSummaryWeight1719398567558'
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`kpiUserEvaluation\` ADD \`weightPoint1\` double NULL COMMENT 'คะแนนประเมินองค์ประกอบที่ 1' DEFAULT '0'`);
await queryRunner.query(`ALTER TABLE \`kpiUserEvaluation\` ADD \`weightPoint2\` double NULL COMMENT 'คะแนนประเมินองค์ประกอบที่ 2' DEFAULT '0'`);
await queryRunner.query(`ALTER TABLE \`kpiUserEvaluation\` ADD \`summaryWeight\` double NULL COMMENT 'คะแนนประเมิน' DEFAULT '0'`);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`kpiUserEvaluation\` DROP COLUMN \`summaryWeight\``);
await queryRunner.query(`ALTER TABLE \`kpiUserEvaluation\` DROP COLUMN \`weightPoint2\``);
await queryRunner.query(`ALTER TABLE \`kpiUserEvaluation\` DROP COLUMN \`weightPoint1\``);
}
}