Skip to content

Commit 749c544

Browse files
authored
fix: Fix bug causing build_user_filter to filter incorrectly. (#1072)
student_id in Submissions refers to the Course Reg ID, not the User ID.
1 parent 11154a6 commit 749c544

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

lib/cadet/assessments/assessments.ex

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1505,7 +1505,9 @@ defmodule Cadet.Assessments do
15051505
submission.student_id in subquery(
15061506
from(user in User,
15071507
where: ilike(user.name, ^"%#{value}%"),
1508-
select: user.id
1508+
inner_join: cr in CourseRegistration,
1509+
on: user.id == cr.user_id,
1510+
select: cr.id
15091511
)
15101512
)
15111513
)
@@ -1517,7 +1519,9 @@ defmodule Cadet.Assessments do
15171519
submission.student_id in subquery(
15181520
from(user in User,
15191521
where: ilike(user.username, ^"%#{value}%"),
1520-
select: user.id
1522+
inner_join: cr in CourseRegistration,
1523+
on: user.id == cr.user_id,
1524+
select: cr.id
15211525
)
15221526
)
15231527
)

0 commit comments

Comments
 (0)