From 2c5423e4ff2e023f51fb56e667eca93c17b454e1 Mon Sep 17 00:00:00 2001 From: AdisakKanthawilang Date: Mon, 15 Jul 2024 17:19:38 +0700 Subject: [PATCH] fix --- src/controllers/ReportController.ts | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/controllers/ReportController.ts b/src/controllers/ReportController.ts index 3f163a0..370dc38 100644 --- a/src/controllers/ReportController.ts +++ b/src/controllers/ReportController.ts @@ -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") {