Description
In src/modules/courses/course.service.ts:49-51, the enrollment count query uses eq(enrollments.courseId, courseIds[0]) — only filtering for the first course ID. All other courses on the page get enrollment count 0.
Impact
The enrolledCount field in course listings is wrong for every course except the first.
File
src/modules/courses/course.service.ts:49-51
Suggested Fix
Replace eq(enrollments.courseId, courseIds[0]) with inArray(enrollments.courseId, courseIds).
Description
In
src/modules/courses/course.service.ts:49-51, the enrollment count query useseq(enrollments.courseId, courseIds[0])— only filtering for the first course ID. All other courses on the page get enrollment count 0.Impact
The
enrolledCountfield in course listings is wrong for every course except the first.File
src/modules/courses/course.service.ts:49-51Suggested Fix
Replace
eq(enrollments.courseId, courseIds[0])withinArray(enrollments.courseId, courseIds).