fix #649 สมรรถนะประจำกลุ่มงานไม่แสดง

This commit is contained in:
Bright 2024-09-30 16:16:23 +07:00
parent 6c777e9589
commit 25e5f19142

View file

@ -22,7 +22,7 @@ import HttpStatusCode from "../interfaces/http-status";
import { KpiCapacity } from "../entities/kpiCapacity";
import { Position } from "../entities/position";
import { KpiCapacityDetail } from "../entities/kpiCapacityDetail";
import { Like, In } from "typeorm";
import { Like, In, Not, IsNull } from "typeorm";
import permission from "../interfaces/permission";
import { RequestWithUser } from "../middlewares/user";
import { setLogDataDiff } from "../interfaces/utils";
@ -230,13 +230,19 @@ export class kpiCapacityController extends Controller {
@Get("group")
async GetKpiCapacityTypeGROUP(@Query("positionName") positionName: string) {
let position = await this.positionRepository.findOne({
where: { name: Like(`${positionName}`) },
where: {
name: Like(`${positionName}`),
kpiLink: Not(IsNull()) || Not("")
},
relations: ["kpiLink", "kpiLink.kpiCapacitys"],
});
if (position == null) {
position = await this.positionRepository.findOne({
where: { name: "นักจัดการงานทั่วไป" },
where: {
name: "นักจัดการงานทั่วไป",
kpiLink: Not(IsNull()) || Not("")
},
relations: ["kpiLink", "kpiLink.kpiCapacitys"],
});
}