fix
This commit is contained in:
parent
db434764fa
commit
290ccdf704
1 changed files with 13 additions and 13 deletions
|
|
@ -300,7 +300,7 @@ export class ReportController extends Controller {
|
||||||
const profileEvaluationNowYearIds = await AppDataSource.getRepository(KpiUserEvaluation)
|
const profileEvaluationNowYearIds = await AppDataSource.getRepository(KpiUserEvaluation)
|
||||||
.createQueryBuilder("kpiUserEvaluation")
|
.createQueryBuilder("kpiUserEvaluation")
|
||||||
.leftJoinAndSelect("kpiUserEvaluation.kpiPeriod", "kpiPeriod")
|
.leftJoinAndSelect("kpiUserEvaluation.kpiPeriod", "kpiPeriod")
|
||||||
.where("kpiUserEvaluation.profileId = :profileId", { profileId: requestBody.profileId })
|
// .where("kpiUserEvaluation.profileId = :profileId", { profileId: requestBody.profileId })
|
||||||
// .where("kpiPeriod.year = :year", { year: yearNow })
|
// .where("kpiPeriod.year = :year", { year: yearNow })
|
||||||
.groupBy("kpiUserEvaluation.kpiPeriodId")
|
.groupBy("kpiUserEvaluation.kpiPeriodId")
|
||||||
.select("MIN(kpiUserEvaluation.id) as id")
|
.select("MIN(kpiUserEvaluation.id) as id")
|
||||||
|
|
@ -341,8 +341,8 @@ export class ReportController extends Controller {
|
||||||
// สร้าง formatData
|
// สร้าง formatData
|
||||||
const combinedDatas = Object.values(groupedEvaluations).map((group: any) => {
|
const combinedDatas = Object.values(groupedEvaluations).map((group: any) => {
|
||||||
const data: any = {
|
const data: any = {
|
||||||
fullName: group.fullName,
|
fullName: group.fullName ?? null,
|
||||||
year: group.year,
|
year: group.year ?? null,
|
||||||
};
|
};
|
||||||
|
|
||||||
group.evaluations.forEach((evaluation: any) => {
|
group.evaluations.forEach((evaluation: any) => {
|
||||||
|
|
@ -389,15 +389,15 @@ export class ReportController extends Controller {
|
||||||
evaluation.summaryPoint < 60
|
evaluation.summaryPoint < 60
|
||||||
? Extension.ToThaiNumber(evaluation.summaryPoint.toString())
|
? Extension.ToThaiNumber(evaluation.summaryPoint.toString())
|
||||||
: null;
|
: null;
|
||||||
data.periodOCT = evaluation.kpiPeriod.durationKPI;
|
data.periodOCT = evaluation.kpiPeriod.durationKPI ?? null;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
});
|
});
|
||||||
formattedData = {
|
formattedData = {
|
||||||
combinedDatas: combinedDatas.length > 0 ? combinedDatas:[{}],
|
combinedDatas: combinedDatas.length > 0 ? combinedDatas : [{}],
|
||||||
fullName: combinedDatas[0]["fullName"],
|
fullName: combinedDatas[0]["fullName"] ?? null,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -462,7 +462,7 @@ export class ReportController extends Controller {
|
||||||
const profileEvaluationIds = await AppDataSource.getRepository(KpiUserEvaluation)
|
const profileEvaluationIds = await AppDataSource.getRepository(KpiUserEvaluation)
|
||||||
.createQueryBuilder("kpiUserEvaluation")
|
.createQueryBuilder("kpiUserEvaluation")
|
||||||
.leftJoinAndSelect("kpiUserEvaluation.kpiPeriod", "kpiPeriod")
|
.leftJoinAndSelect("kpiUserEvaluation.kpiPeriod", "kpiPeriod")
|
||||||
.where("kpiUserEvaluation.profileId = :profileId", { profileId: requestBody.profileId })
|
// .where("kpiUserEvaluation.profileId = :profileId", { profileId: requestBody.profileId })
|
||||||
.andWhere("kpiPeriod.year BETWEEN :startYear AND :endYear", {
|
.andWhere("kpiPeriod.year BETWEEN :startYear AND :endYear", {
|
||||||
startYear: yearNow - 4,
|
startYear: yearNow - 4,
|
||||||
endYear: yearNow,
|
endYear: yearNow,
|
||||||
|
|
@ -673,7 +673,7 @@ export class ReportController extends Controller {
|
||||||
const profileEvaluationIds = await AppDataSource.getRepository(KpiUserEvaluation)
|
const profileEvaluationIds = await AppDataSource.getRepository(KpiUserEvaluation)
|
||||||
.createQueryBuilder("kpiUserEvaluation")
|
.createQueryBuilder("kpiUserEvaluation")
|
||||||
.leftJoinAndSelect("kpiUserEvaluation.kpiPeriod", "kpiPeriod")
|
.leftJoinAndSelect("kpiUserEvaluation.kpiPeriod", "kpiPeriod")
|
||||||
.where("kpiUserEvaluation.profileId = :profileId", { profileId: requestBody.profileId })
|
// .where("kpiUserEvaluation.profileId = :profileId", { profileId: requestBody.profileId })
|
||||||
.andWhere("kpiPeriod.year BETWEEN :startYear AND :endYear", {
|
.andWhere("kpiPeriod.year BETWEEN :startYear AND :endYear", {
|
||||||
startYear: yearNow - 2,
|
startYear: yearNow - 2,
|
||||||
endYear: yearNow,
|
endYear: yearNow,
|
||||||
|
|
@ -826,7 +826,7 @@ export class ReportController extends Controller {
|
||||||
const profileEvaluationIds = await AppDataSource.getRepository(KpiUserEvaluation)
|
const profileEvaluationIds = await AppDataSource.getRepository(KpiUserEvaluation)
|
||||||
.createQueryBuilder("kpiUserEvaluation")
|
.createQueryBuilder("kpiUserEvaluation")
|
||||||
.leftJoinAndSelect("kpiUserEvaluation.kpiPeriod", "kpiPeriod")
|
.leftJoinAndSelect("kpiUserEvaluation.kpiPeriod", "kpiPeriod")
|
||||||
.where("kpiUserEvaluation.profileId = :profileId", { profileId: requestBody.profileId })
|
// .where("kpiUserEvaluation.profileId = :profileId", { profileId: requestBody.profileId })
|
||||||
.andWhere("kpiUserEvaluation.kpiPeriodId = :kpiPeriodId", {
|
.andWhere("kpiUserEvaluation.kpiPeriodId = :kpiPeriodId", {
|
||||||
kpiPeriodId: requestBody.periodId,
|
kpiPeriodId: requestBody.periodId,
|
||||||
})
|
})
|
||||||
|
|
@ -868,7 +868,7 @@ export class ReportController extends Controller {
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
|
|
||||||
const fullNameParts = [userInfo[0].child4, userInfo[0].child3, userInfo[0].child2, userInfo[0].child1, userInfo[0].org];
|
const fullNameParts = [userInfo[0]?.child4, userInfo[0]?.child3, userInfo[0]?.child2, userInfo[0]?.child1, userInfo[0]?.org];
|
||||||
const affiliation = fullNameParts
|
const affiliation = fullNameParts
|
||||||
.filter((part) => part !== undefined && part !== null)
|
.filter((part) => part !== undefined && part !== null)
|
||||||
.join("/");
|
.join("/");
|
||||||
|
|
@ -876,8 +876,8 @@ export class ReportController extends Controller {
|
||||||
fullName: userInfo
|
fullName: userInfo
|
||||||
? userInfo[0].prefix + userInfo[0].firstName + " " + userInfo[0].lastName
|
? userInfo[0].prefix + userInfo[0].firstName + " " + userInfo[0].lastName
|
||||||
: null,
|
: null,
|
||||||
affiliation: affiliation,
|
affiliation: affiliation ?? null,
|
||||||
durationKPI: data?.durationKPI,
|
durationKPI: data?.durationKPI ?? null,
|
||||||
position: userInfo ? userInfo[0].position : null,
|
position: userInfo ? userInfo[0].position : null,
|
||||||
posType: userInfo ? userInfo[0].posTypeName : null,
|
posType: userInfo ? userInfo[0].posTypeName : null,
|
||||||
posLevel: userInfo ? userInfo[0].posLevelName : null,
|
posLevel: userInfo ? userInfo[0].posLevelName : null,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue