refactor: monitoring student function
This commit is contained in:
parent
2245c8440d
commit
b6885b4e89
|
|
@ -119,11 +119,23 @@ export const updateStdLearningById = async (req, res) => {
|
||||||
) {
|
) {
|
||||||
req.body.ID_STUDENT_LEARNING = id;
|
req.body.ID_STUDENT_LEARNING = id;
|
||||||
|
|
||||||
const existingMonitoring = await models.Monitoring.findOne({
|
const existingMonitoringForTopic = await models.Monitoring.findOne({
|
||||||
where: { ID_STUDENT_LEARNING: id },
|
include: [
|
||||||
|
{
|
||||||
|
model: models.StdLearning,
|
||||||
|
as: "stdLearningMonitoring",
|
||||||
|
include: [
|
||||||
|
{
|
||||||
|
model: models.Level,
|
||||||
|
as: "level",
|
||||||
|
where: { ID_TOPIC: stdLearning.level.ID_TOPIC },
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!existingMonitoring) {
|
if (!existingMonitoringForTopic) {
|
||||||
const newMonitoring = await createMonitoring(req);
|
const newMonitoring = await createMonitoring(req);
|
||||||
|
|
||||||
const { level, ...responseData } = stdLearning.toJSON();
|
const { level, ...responseData } = stdLearning.toJSON();
|
||||||
|
|
|
||||||
|
|
@ -361,6 +361,7 @@ export const monitoringStudentProgressById = async (req, res) => {
|
||||||
"STUDENT_START",
|
"STUDENT_START",
|
||||||
"STUDENT_FINISH",
|
"STUDENT_FINISH",
|
||||||
],
|
],
|
||||||
|
order: [["STUDENT_FINISH", "DESC"]],
|
||||||
distinct: true,
|
distinct: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user