This commit is contained in:
AdisakKanthawilang 2025-01-06 15:05:36 +07:00
parent b3529b4b9c
commit 6f5eb2455a

View file

@ -61,11 +61,12 @@ export class ReoportController {
async sumaryEvaluationReport(@Query("year") year?: string, @Query("rootid") rootId?: string) {
const yearInAD = year?year:null;
const yearInBE = yearInAD ? (parseInt(yearInAD) - 543).toString() : null;
const evaluation = await AppDataSource.getRepository(Evaluation)
.createQueryBuilder("evaluation")
.where('evaluation.evaluationResult NOT IN (:...evaluationResults)', { evaluationResults: ['PENDING'] })
.andWhere( yearInAD && yearInAD != null? 'YEAR(createdAt) = :year': "1=1", { year: yearInAD })
.andWhere( yearInBE && yearInBE != null? 'YEAR(createdAt) = :year': "1=1", { year: yearInBE })
.andWhere(rootId?'orgRootId = :rootId': "1=1", { rootId: rootId })
.andWhere('evaluation.step = :step', { step: 'DONE' })
.getMany();