This commit is contained in:
AdisakKanthawilang 2024-07-15 17:19:38 +07:00
parent 92825464df
commit 2c5423e4ff

View file

@ -564,7 +564,6 @@ export class ReportController extends Controller {
return data;
});
}
formattedData = {
@ -632,7 +631,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,
@ -640,7 +639,7 @@ export class ReportController extends Controller {
.groupBy("kpiUserEvaluation.kpiPeriodId")
.select("MIN(kpiUserEvaluation.id) as id")
.getRawMany();
if (profileEvaluationIds.length > 0) {
// if (profileEvaluationIds.length > 0) {
const profileEvaluation = await this.kpiUserEvaluationRepository.find({
relations: ["kpiPeriod"],
where: { id: In(profileEvaluationIds.map((evaluation) => evaluation.id)) },
@ -799,7 +798,7 @@ export class ReportController extends Controller {
},
);
formattedData = combinedData;
}
// }
}
}
if (requestBody.type == "KPI6") {
@ -845,7 +844,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,
@ -853,7 +852,7 @@ export class ReportController extends Controller {
.groupBy("kpiUserEvaluation.kpiPeriodId")
.select("MIN(kpiUserEvaluation.id) as id")
.getRawMany();
if (profileEvaluationIds.length > 0) {
// if (profileEvaluationIds.length > 0) {
const profileEvaluation = await this.kpiUserEvaluationRepository.find({
relations: ["kpiPeriod"],
where: { id: In(profileEvaluationIds.map((evaluation) => evaluation.id)) },
@ -961,7 +960,7 @@ export class ReportController extends Controller {
},
);
formattedData = combinedData;
}
// }
}
}
if (requestBody.type == "KPI7") {