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)
|
||||
.createQueryBuilder("kpiUserEvaluation")
|
||||
.leftJoinAndSelect("kpiUserEvaluation.kpiPeriod", "kpiPeriod")
|
||||
.where("kpiUserEvaluation.profileId = :profileId", { profileId: requestBody.profileId })
|
||||
// .where("kpiUserEvaluation.profileId = :profileId", { profileId: requestBody.profileId })
|
||||
// .where("kpiPeriod.year = :year", { year: yearNow })
|
||||
.groupBy("kpiUserEvaluation.kpiPeriodId")
|
||||
.select("MIN(kpiUserEvaluation.id) as id")
|
||||
|
|
@ -341,8 +341,8 @@ export class ReportController extends Controller {
|
|||
// สร้าง formatData
|
||||
const combinedDatas = Object.values(groupedEvaluations).map((group: any) => {
|
||||
const data: any = {
|
||||
fullName: group.fullName,
|
||||
year: group.year,
|
||||
fullName: group.fullName ?? null,
|
||||
year: group.year ?? null,
|
||||
};
|
||||
|
||||
group.evaluations.forEach((evaluation: any) => {
|
||||
|
|
@ -389,15 +389,15 @@ export class ReportController extends Controller {
|
|||
evaluation.summaryPoint < 60
|
||||
? Extension.ToThaiNumber(evaluation.summaryPoint.toString())
|
||||
: null;
|
||||
data.periodOCT = evaluation.kpiPeriod.durationKPI;
|
||||
data.periodOCT = evaluation.kpiPeriod.durationKPI ?? null;
|
||||
}
|
||||
});
|
||||
|
||||
return data;
|
||||
});
|
||||
formattedData = {
|
||||
combinedDatas: combinedDatas.length > 0 ? combinedDatas:[{}],
|
||||
fullName: combinedDatas[0]["fullName"],
|
||||
formattedData = {
|
||||
combinedDatas: combinedDatas.length > 0 ? combinedDatas : [{}],
|
||||
fullName: combinedDatas[0]["fullName"] ?? null,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
@ -462,7 +462,7 @@ export class ReportController extends Controller {
|
|||
const profileEvaluationIds = await AppDataSource.getRepository(KpiUserEvaluation)
|
||||
.createQueryBuilder("kpiUserEvaluation")
|
||||
.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", {
|
||||
startYear: yearNow - 4,
|
||||
endYear: yearNow,
|
||||
|
|
@ -673,7 +673,7 @@ export class ReportController extends Controller {
|
|||
const profileEvaluationIds = await AppDataSource.getRepository(KpiUserEvaluation)
|
||||
.createQueryBuilder("kpiUserEvaluation")
|
||||
.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", {
|
||||
startYear: yearNow - 2,
|
||||
endYear: yearNow,
|
||||
|
|
@ -826,7 +826,7 @@ export class ReportController extends Controller {
|
|||
const profileEvaluationIds = await AppDataSource.getRepository(KpiUserEvaluation)
|
||||
.createQueryBuilder("kpiUserEvaluation")
|
||||
.leftJoinAndSelect("kpiUserEvaluation.kpiPeriod", "kpiPeriod")
|
||||
.where("kpiUserEvaluation.profileId = :profileId", { profileId: requestBody.profileId })
|
||||
// .where("kpiUserEvaluation.profileId = :profileId", { profileId: requestBody.profileId })
|
||||
.andWhere("kpiUserEvaluation.kpiPeriodId = :kpiPeriodId", {
|
||||
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
|
||||
.filter((part) => part !== undefined && part !== null)
|
||||
.join("/");
|
||||
|
|
@ -876,8 +876,8 @@ export class ReportController extends Controller {
|
|||
fullName: userInfo
|
||||
? userInfo[0].prefix + userInfo[0].firstName + " " + userInfo[0].lastName
|
||||
: null,
|
||||
affiliation: affiliation,
|
||||
durationKPI: data?.durationKPI,
|
||||
affiliation: affiliation ?? null,
|
||||
durationKPI: data?.durationKPI ?? null,
|
||||
position: userInfo ? userInfo[0].position : null,
|
||||
posType: userInfo ? userInfo[0].posTypeName : null,
|
||||
posLevel: userInfo ? userInfo[0].posLevelName : null,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue