fix: exclude deleted students/entries/groups from journal student filter
This commit is contained in:
@@ -9285,7 +9285,13 @@ app.get('/api/students/names', requireAuth, async (req, res) => {
|
||||
const { rows } = await pool.query(
|
||||
`SELECT DISTINCT e.student_name AS name FROM entries e
|
||||
JOIN groups g ON g.id = e.group_id
|
||||
WHERE e.student_name IS NOT NULL AND e.student_name <> ''${bw.where}
|
||||
WHERE e.student_name IS NOT NULL AND e.student_name <> ''
|
||||
AND e.deleted_at IS NULL
|
||||
AND g.deleted_at IS NULL
|
||||
AND NOT EXISTS (
|
||||
SELECT 1 FROM students s
|
||||
WHERE TRIM(s.name) = TRIM(e.student_name) AND s.deleted_at IS NOT NULL
|
||||
)${bw.where}
|
||||
ORDER BY name`,
|
||||
bw.params
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user