fixing result

This commit is contained in:
Warunee Tamkoo 2025-01-30 11:21:33 +07:00
parent e9321501bf
commit d69872d421

View file

@ -214,26 +214,15 @@ export class EvaluateResultController extends Controller {
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลผู้ดูแล"); throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลผู้ดูแล");
} }
const director_id = director.personal_id; const director_id = director.personal_id;
let evaluate: any = null;
if (evaluate_no) { const evaluate = await this.evaluateResultRepository.findOne({
evaluate = await this.evaluateResultRepository.findOne({ where: {
where: { director_id,
director_id, assign_id,
assign_id, no: evaluate_no ?? "1",
no: evaluate_no, },
}, });
});
// if (!evaluate) {
// throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลแบบประเมิน");
// }
} else {
evaluate = await this.evaluateResultRepository.findOne({
where: {
director_id,
assign_id,
},
});
}
if (!evaluate) { if (!evaluate) {
return new HttpSuccess(null); return new HttpSuccess(null);
} }
@ -302,26 +291,34 @@ export class EvaluateResultController extends Controller {
} }
} }
const commanderData = await (directorData.find((x) => x.role == "commander") ?? null); // const commanderData = await (directorData.find((x) => x.role == "commander") ?? null);
const commander = // const commander =
commanderData != null // commanderData != null
? { // ? {
personal_id: commanderData.personal_id, // personal_id: commanderData.personal_id,
dated: commanderData.dated, // dated: commanderData.dated,
name: commanderData.fullname, // name: commanderData.fullname,
label: // label:
commanderData.fullname + // commanderData.fullname +
" " + // " " +
(commanderData.position // (commanderData.position
? `(${commanderData.position}${commanderData.posLevel})` // ? `(${commanderData.position}${commanderData.posLevel})`
: ""), // : ""),
position: commanderData.position + commanderData.posLevel, // position: commanderData.position + commanderData.posLevel,
posType: commanderData.posType, // posType: commanderData.posType,
posLevel: commanderData.posLevel, // posLevel: commanderData.posLevel,
} // }
: null; // : null;
const commander = {
dated: evaluate.authority_dated,
name: evaluate.authority_name,
position: evaluate.authority_pos + evaluate.authority_level,
posType: evaluate.authority_type,
posLevel: evaluate.authority_level,
};
const chairmanData = await (directorData.find((x) => x.role == "chairman") ?? null); const chairmanData = await (directorData.find((x) => x.role == "chairman") ?? null);
const chairman = const chairman =
chairmanData != null chairmanData != null