fix
This commit is contained in:
parent
aec7608e9d
commit
e2bec57f59
2 changed files with 143 additions and 143 deletions
|
|
@ -52,7 +52,7 @@ export class KpiUserCapacityController extends Controller {
|
||||||
requestBody: {
|
requestBody: {
|
||||||
kpiUserEvaluationId: string;
|
kpiUserEvaluationId: string;
|
||||||
kpiCapacityId: string;
|
kpiCapacityId: string;
|
||||||
level: string;
|
level: string | null;
|
||||||
weight: number;
|
weight: number;
|
||||||
},
|
},
|
||||||
@Request() request: { user: Record<string, any> },
|
@Request() request: { user: Record<string, any> },
|
||||||
|
|
|
||||||
|
|
@ -323,153 +323,153 @@ export class KpiUserEvaluationController extends Controller {
|
||||||
kpiUserEvaluation.lastUpdateFullName = request.user.name;
|
kpiUserEvaluation.lastUpdateFullName = request.user.name;
|
||||||
await this.kpiUserEvalutionRepository.save(kpiUserEvaluation);
|
await this.kpiUserEvalutionRepository.save(kpiUserEvaluation);
|
||||||
|
|
||||||
// enum CapacityType {
|
enum CapacityType {
|
||||||
// HEAD = "HEAD",
|
HEAD = "HEAD",
|
||||||
// GROUP = "GROUP",
|
GROUP = "GROUP",
|
||||||
// }
|
}
|
||||||
|
|
||||||
// // MAIN CAPACITY
|
// MAIN CAPACITY
|
||||||
// const mainCapacities = await this.kpiCapacityRepository.find({
|
const mainCapacities = await this.kpiCapacityRepository.find({
|
||||||
// where: { type: CapacityType.HEAD },
|
where: { type: CapacityType.HEAD },
|
||||||
// });
|
});
|
||||||
|
|
||||||
// let level: any;
|
let level: any;
|
||||||
// switch (level) {
|
switch (level) {
|
||||||
// case kpiUserEvaluation.posTypeName == "บริหาร" && kpiUserEvaluation.posLevelName == "สูง":
|
case kpiUserEvaluation.posTypeName == "บริหาร" && kpiUserEvaluation.posLevelName == "สูง":
|
||||||
// level = 5;
|
level = "5";
|
||||||
// break;
|
break;
|
||||||
// case kpiUserEvaluation.posTypeName == "บริหาร" && kpiUserEvaluation.posLevelName == "ต้น":
|
case kpiUserEvaluation.posTypeName == "บริหาร" && kpiUserEvaluation.posLevelName == "ต้น":
|
||||||
// level = 4;
|
level = "4";
|
||||||
// break;
|
break;
|
||||||
// case kpiUserEvaluation.posTypeName == "อำนวยการ" && kpiUserEvaluation.posLevelName == "สูง":
|
case kpiUserEvaluation.posTypeName == "อำนวยการ" && kpiUserEvaluation.posLevelName == "สูง":
|
||||||
// level = 4;
|
level = "4";
|
||||||
// break;
|
break;
|
||||||
// case kpiUserEvaluation.posTypeName == "อำนวยการ" && kpiUserEvaluation.posLevelName == "ต้น":
|
case kpiUserEvaluation.posTypeName == "อำนวยการ" && kpiUserEvaluation.posLevelName == "ต้น":
|
||||||
// level = 3;
|
level = "3";
|
||||||
// break;
|
break;
|
||||||
// case kpiUserEvaluation.posTypeName == "วิชาการ" &&
|
case kpiUserEvaluation.posTypeName == "วิชาการ" &&
|
||||||
// kpiUserEvaluation.posLevelName == "ทรงคุณวุฒิ":
|
kpiUserEvaluation.posLevelName == "ทรงคุณวุฒิ":
|
||||||
// level = 5;
|
level = "5";
|
||||||
// break;
|
break;
|
||||||
// case kpiUserEvaluation.posTypeName == "วิชาการ" &&
|
case kpiUserEvaluation.posTypeName == "วิชาการ" &&
|
||||||
// kpiUserEvaluation.posLevelName == "เชี่ยวชาญ":
|
kpiUserEvaluation.posLevelName == "เชี่ยวชาญ":
|
||||||
// level = 4;
|
level = "4";
|
||||||
// break;
|
break;
|
||||||
// case kpiUserEvaluation.posTypeName == "วิชาการ" &&
|
case kpiUserEvaluation.posTypeName == "วิชาการ" &&
|
||||||
// kpiUserEvaluation.posLevelName == "ชำนาญการพิเศษ":
|
kpiUserEvaluation.posLevelName == "ชำนาญการพิเศษ":
|
||||||
// level = 3;
|
level = "3";
|
||||||
// break;
|
break;
|
||||||
// case kpiUserEvaluation.posTypeName == "วิชาการ" &&
|
case kpiUserEvaluation.posTypeName == "วิชาการ" &&
|
||||||
// kpiUserEvaluation.posLevelName == "ชำนาญการ":
|
kpiUserEvaluation.posLevelName == "ชำนาญการ":
|
||||||
// level = 2;
|
level = "2";
|
||||||
// break;
|
break;
|
||||||
// case kpiUserEvaluation.posTypeName == "วิชาการ" &&
|
case kpiUserEvaluation.posTypeName == "วิชาการ" &&
|
||||||
// kpiUserEvaluation.posLevelName == "ปฏิบัติการ":
|
kpiUserEvaluation.posLevelName == "ปฏิบัติการ":
|
||||||
// level = 1;
|
level = "1";
|
||||||
// break;
|
break;
|
||||||
// case kpiUserEvaluation.posTypeName == "ทั่วไป" &&
|
case kpiUserEvaluation.posTypeName == "ทั่วไป" &&
|
||||||
// kpiUserEvaluation.posLevelName == "ทักษะพิเศษ":
|
kpiUserEvaluation.posLevelName == "ทักษะพิเศษ":
|
||||||
// level = 4;
|
level = "4";
|
||||||
// break;
|
break;
|
||||||
// case kpiUserEvaluation.posTypeName == "ทั่วไป" && kpiUserEvaluation.posLevelName == "อาวุโส":
|
case kpiUserEvaluation.posTypeName == "ทั่วไป" && kpiUserEvaluation.posLevelName == "อาวุโส":
|
||||||
// level = 3;
|
level = "3";
|
||||||
// break;
|
break;
|
||||||
// case kpiUserEvaluation.posTypeName == "ทั่วไป" &&
|
case kpiUserEvaluation.posTypeName == "ทั่วไป" &&
|
||||||
// kpiUserEvaluation.posLevelName == "ชำนาญงาน":
|
kpiUserEvaluation.posLevelName == "ชำนาญงาน":
|
||||||
// level = 2;
|
level = "2";
|
||||||
// break;
|
break;
|
||||||
// case kpiUserEvaluation.posTypeName == "ทั่วไป" &&
|
case kpiUserEvaluation.posTypeName == "ทั่วไป" &&
|
||||||
// kpiUserEvaluation.posLevelName == "ปฏิบัติงาน":
|
kpiUserEvaluation.posLevelName == "ปฏิบัติงาน":
|
||||||
// level = 1;
|
level = "1";
|
||||||
// break;
|
break;
|
||||||
// default:
|
default:
|
||||||
// level = null;
|
level = null;
|
||||||
// break;
|
break;
|
||||||
// }
|
}
|
||||||
// for (const capacity of mainCapacities) {
|
for (const capacity of mainCapacities) {
|
||||||
// await new CallAPI()
|
await new CallAPI()
|
||||||
// .PostData(request, "kpi/user/capacity", {
|
.PostData(request, "kpi/user/capacity", {
|
||||||
// kpiUserEvaluationId: kpiUserEvaluation.id,
|
kpiUserEvaluationId: kpiUserEvaluation.id,
|
||||||
// kpiCapacityId: capacity.id,
|
kpiCapacityId: capacity.id,
|
||||||
// level: level,
|
level: level,
|
||||||
// weight: 100,
|
weight: 100,
|
||||||
// })
|
})
|
||||||
// .catch((x) => {
|
.catch((x) => {
|
||||||
// throw new HttpError(HttpStatusCode.NOT_FOUND, x);
|
throw new HttpError(HttpStatusCode.NOT_FOUND, x);
|
||||||
// });
|
});
|
||||||
// }
|
}
|
||||||
|
|
||||||
// // GROUP CAPACITY
|
// GROUP CAPACITY
|
||||||
// const findPosition = await this.kpiPositionRepository.findOne({
|
const findPosition = await this.kpiPositionRepository.findOne({
|
||||||
// where: { name: kpiUserEvaluation.position },
|
where: { name: kpiUserEvaluation.position },
|
||||||
// });
|
});
|
||||||
|
|
||||||
// let levelForGourp: any;
|
let levelForGourp: any;
|
||||||
// switch (levelForGourp) {
|
switch (levelForGourp) {
|
||||||
// case kpiUserEvaluation.posTypeName == "วิชาการ" &&
|
case kpiUserEvaluation.posTypeName == "วิชาการ" &&
|
||||||
// kpiUserEvaluation.posLevelName == "ทรงคุณวุฒิ":
|
kpiUserEvaluation.posLevelName == "ทรงคุณวุฒิ":
|
||||||
// level = 5;
|
level = "5";
|
||||||
// break;
|
break;
|
||||||
// case kpiUserEvaluation.posTypeName == "วิชาการ" &&
|
case kpiUserEvaluation.posTypeName == "วิชาการ" &&
|
||||||
// kpiUserEvaluation.posLevelName == "เชี่ยวชาญ":
|
kpiUserEvaluation.posLevelName == "เชี่ยวชาญ":
|
||||||
// level = 4;
|
level = "4";
|
||||||
// break;
|
break;
|
||||||
// case kpiUserEvaluation.posTypeName == "วิชาการ" &&
|
case kpiUserEvaluation.posTypeName == "วิชาการ" &&
|
||||||
// kpiUserEvaluation.posLevelName == "ชำนาญการพิเศษ":
|
kpiUserEvaluation.posLevelName == "ชำนาญการพิเศษ":
|
||||||
// level = 4;
|
level = "4";
|
||||||
// break;
|
break;
|
||||||
// case kpiUserEvaluation.posTypeName == "วิชาการ" &&
|
case kpiUserEvaluation.posTypeName == "วิชาการ" &&
|
||||||
// kpiUserEvaluation.posLevelName == "ชำนาญการ":
|
kpiUserEvaluation.posLevelName == "ชำนาญการ":
|
||||||
// level = 3;
|
level = "3";
|
||||||
// break;
|
break;
|
||||||
// case kpiUserEvaluation.posTypeName == "วิชาการ" &&
|
case kpiUserEvaluation.posTypeName == "วิชาการ" &&
|
||||||
// kpiUserEvaluation.posLevelName == "ปฏิบัติการ":
|
kpiUserEvaluation.posLevelName == "ปฏิบัติการ":
|
||||||
// level = 2;
|
level = "2";
|
||||||
// break;
|
break;
|
||||||
// case kpiUserEvaluation.posTypeName == "ทั่วไป" &&
|
case kpiUserEvaluation.posTypeName == "ทั่วไป" &&
|
||||||
// kpiUserEvaluation.posLevelName == "ทักษะพิเศษ":
|
kpiUserEvaluation.posLevelName == "ทักษะพิเศษ":
|
||||||
// level = 4;
|
level = "4";
|
||||||
// break;
|
break;
|
||||||
// case kpiUserEvaluation.posTypeName == "ทั่วไป" &&
|
case kpiUserEvaluation.posTypeName == "ทั่วไป" &&
|
||||||
// kpiUserEvaluation.posLevelName == "อาวุโส":
|
kpiUserEvaluation.posLevelName == "อาวุโส":
|
||||||
// level = 3;
|
level = "3";
|
||||||
// break;
|
break;
|
||||||
// case kpiUserEvaluation.posTypeName == "ทั่วไป" &&
|
case kpiUserEvaluation.posTypeName == "ทั่วไป" &&
|
||||||
// kpiUserEvaluation.posLevelName == "ชำนาญงาน":
|
kpiUserEvaluation.posLevelName == "ชำนาญงาน":
|
||||||
// level = 2;
|
level = "2";
|
||||||
// break;
|
break;
|
||||||
// case kpiUserEvaluation.posTypeName == "ทั่วไป" &&
|
case kpiUserEvaluation.posTypeName == "ทั่วไป" &&
|
||||||
// kpiUserEvaluation.posLevelName == "ปฏิบัติงาน":
|
kpiUserEvaluation.posLevelName == "ปฏิบัติงาน":
|
||||||
// level = 1;
|
level = "1";
|
||||||
// break;
|
break;
|
||||||
// default:
|
default:
|
||||||
// level = null;
|
level = null;
|
||||||
// break;
|
break;
|
||||||
// }
|
}
|
||||||
|
|
||||||
// if (findPosition && findPosition.kpiLinkId && level != null) {
|
if (findPosition && findPosition.kpiLinkId && level != null) {
|
||||||
// const findKpiLink = await this.kpiLinkRepository.findOne({
|
const findKpiLink = await this.kpiLinkRepository.findOne({
|
||||||
// relations: ["kpiCapacities"],
|
relations: ["kpiCapacities"],
|
||||||
// where: {
|
where: {
|
||||||
// id: findPosition.kpiLinkId,
|
id: findPosition.kpiLinkId,
|
||||||
// },
|
},
|
||||||
// });
|
});
|
||||||
// if (findKpiLink) {
|
if (findKpiLink) {
|
||||||
// let groupCapacity = findKpiLink.kpiCapacitys;
|
let groupCapacity = findKpiLink.kpiCapacitys;
|
||||||
// for (const capacity of groupCapacity) {
|
for (const capacity of groupCapacity) {
|
||||||
// await new CallAPI()
|
await new CallAPI()
|
||||||
// .PostData(request, "kpi/user/capacity", {
|
.PostData(request, "kpi/user/capacity", {
|
||||||
// kpiUserEvaluationId: kpiUserEvaluation.id,
|
kpiUserEvaluationId: kpiUserEvaluation.id,
|
||||||
// kpiCapacityId: capacity.id,
|
kpiCapacityId: capacity.id,
|
||||||
// level: levelForGourp,
|
level: levelForGourp,
|
||||||
// weight: 100,
|
weight: 100,
|
||||||
// })
|
})
|
||||||
// .catch((error) => {
|
.catch((error) => {
|
||||||
// throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่สามารถสร้างข้อมูลสมรรถนะได้");
|
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่สามารถสร้างข้อมูลสมรรถนะได้");
|
||||||
// });
|
});
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
|
|
||||||
return new HttpSuccess(kpiUserEvaluation.id);
|
return new HttpSuccess(kpiUserEvaluation.id);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue