Skip to content

Commit 55fa242

Browse files
committed
fix: lecture count
1 parent 7a22f2b commit 55fa242

File tree

2 files changed

+7
-9
lines changed

2 files changed

+7
-9
lines changed

packages/service-content/src/lib/professors/queries/get-professor.ts

+3-4
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,9 @@ export const getProfessorQuery = (id: string, language?: string) => {
4444
4545
-- Lateral join for lectures
4646
LEFT JOIN LATERAL (
47-
SELECT COUNT(clp.chapter_id) AS lectures_count
48-
FROM content.course_chapters_localized_professors clp
49-
WHERE clp.contributor_id = p.contributor_id
50-
AND clp.language = LOWER(${language})
47+
SELECT COUNT(ev) AS lectures_count
48+
FROM content.events ev
49+
WHERE ev.professor = p.contributor_id
5150
) lca ON TRUE
5251
5352

packages/service-content/src/lib/professors/queries/get-professors.ts

+4-5
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,11 @@ export const getProfessorsQuery = ({
4848
WHERE tc.contributor_id = p.contributor_id
4949
) tca ON TRUE
5050
51-
-- Lateral join for lectures with unique chapter count
51+
-- Lateral join for lectures
5252
LEFT JOIN LATERAL (
53-
SELECT COUNT(clp.chapter_id) AS lectures_count
54-
FROM content.course_chapters_localized_professors clp
55-
WHERE clp.contributor_id = p.contributor_id
56-
AND clp.language = LOWER(${language})
53+
SELECT COUNT(ev) AS lectures_count
54+
FROM content.events ev
55+
WHERE ev.professor = p.contributor_id
5756
) lca ON TRUE
5857
5958
${language ? sql`WHERE pl.language = LOWER(${language})` : sql``}

0 commit comments

Comments
 (0)