This commit is contained in:
Warunee Tamkoo 2025-01-30 14:10:35 +07:00
parent 4bbcb6d9d9
commit 7b853002c5

View file

@ -139,6 +139,7 @@ export class EvaluateResultController extends Controller {
"develop_self_learning_score", "develop_self_learning_score",
"develop_training_seminar_score", "develop_training_seminar_score",
"evaluate_result", "evaluate_result",
"no",
], ],
where: { where: {
assign_id, assign_id,
@ -149,21 +150,27 @@ export class EvaluateResultController extends Controller {
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลการประเมินผล"); throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลการประเมินผล");
} }
const result = resultData.map((e) => { const result = await Promise.all(
const develop_complete = resultData.map(async (e) => {
e.develop_orientation_score > 0 && const check = await this.evaluateResultRepository.count({ where: { assign_id, no: e.no } });
e.develop_self_learning_score > 0 &&
e.develop_training_seminar_score
? 1
: 2;
const evaluate_result = e.evaluate_result === 1 ? 1 : 2; const develop_complete =
e.develop_orientation_score > 0 &&
e.develop_self_learning_score > 0 &&
e.develop_training_seminar_score
? 1
: 2;
return { const evaluate_result = e.evaluate_result === 1 ? 1 : 2;
develop_complete,
evaluate_result, return {
}; develop_complete,
}); evaluate_result,
evaluate_no: Number(e.no),
isResult: check > 0 ? true : false,
};
}),
);
// const develop_complete = await (resultData.develop_orientation_score > 0 && // const develop_complete = await (resultData.develop_orientation_score > 0 &&
// resultData.develop_self_learning_score > 0 && // resultData.develop_self_learning_score > 0 &&