refactor: stdLearning student activities bug fix

This commit is contained in:
elangptra 2024-10-24 09:46:11 +07:00
parent f88da97055
commit a3b34c3136

View File

@ -251,9 +251,17 @@ export const learningHistory = async (req, res) => {
const { ID } = req.user; const { ID } = req.user;
const stdLearnings = await models.StdLearning.findAll({ const stdLearnings = await models.StdLearning.findAll({
where: { ID }, where: {
STUDENT_FINISH: { ID,
[models.Sequelize.Op.ne]: null, STUDENT_FINISH: {
[models.Sequelize.Op.ne]: null,
},
SCORE: {
[models.Sequelize.Op.ne]: null,
},
NEXT_LEARNING: {
[models.Sequelize.Op.ne]: null,
},
}, },
include: [ include: [
{ {
@ -351,9 +359,17 @@ export const learningHistoryBySectionId = async (req, res) => {
const { sectionId } = req.params; const { sectionId } = req.params;
const stdLearnings = await models.StdLearning.findAll({ const stdLearnings = await models.StdLearning.findAll({
where: { ID }, where: {
STUDENT_FINISH: { ID,
[models.Sequelize.Op.ne]: null, STUDENT_FINISH: {
[models.Sequelize.Op.ne]: null,
},
SCORE: {
[models.Sequelize.Op.ne]: null,
},
NEXT_LEARNING: {
[models.Sequelize.Op.ne]: null,
},
}, },
include: [ include: [
{ {
@ -456,9 +472,17 @@ export const learningHistoryByTopicId = async (req, res) => {
} }
const stdLearnings = await models.StdLearning.findAll({ const stdLearnings = await models.StdLearning.findAll({
where: { ID }, where: {
STUDENT_FINISH: { ID,
[models.Sequelize.Op.ne]: null, STUDENT_FINISH: {
[models.Sequelize.Op.ne]: null,
},
SCORE: {
[models.Sequelize.Op.ne]: null,
},
NEXT_LEARNING: {
[models.Sequelize.Op.ne]: null,
},
}, },
include: [ include: [
{ {
@ -548,6 +572,17 @@ export const learningHistoryByTopicId = async (req, res) => {
export const recentStudentActivities = async (req, res) => { export const recentStudentActivities = async (req, res) => {
try { try {
const stdLearnings = await models.StdLearning.findAll({ const stdLearnings = await models.StdLearning.findAll({
where: {
STUDENT_FINISH: {
[models.Sequelize.Op.ne]: null,
},
SCORE: {
[models.Sequelize.Op.ne]: null,
},
NEXT_LEARNING: {
[models.Sequelize.Op.ne]: null,
},
},
include: [ include: [
{ {
model: models.User, model: models.User,