Skip to content

fix: duplicate courses and batches in created lists - #2686

Open
zaveshaa wants to merge 2 commits into
frappe:developfrom
zaveshaa:fix-created-courses-duplicates
Open

fix: duplicate courses and batches in created lists#2686
zaveshaa wants to merge 2 commits into
frappe:developfrom
zaveshaa:fix-created-courses-duplicates

Conversation

@zaveshaa

@zaveshaa zaveshaa commented Aug 25, 2026

Copy link
Copy Markdown

Fixes #2476.

get_created_courses() joins Course Instructor with LMS Course, so each course is returned once per instructor row. A course with 3 instructors shows up 3 times on the moderator home page and fills the whole limit(3), hiding other courses.

The fix adds .distinct() to the course query. While testing the same pattern I noticed get_created_batches() has the same issue when the current user is one of several instructors on a batch, so it got the same one-line fix.

@greptile-apps

greptile-apps Bot commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains within the eligible follow-up scope.

Reviews (3): Last reviewed commit: "Merge develop into fix-created-courses-d..." | Re-trigger Greptile

@raizasafeel

Copy link
Copy Markdown
Contributor

As per our commit guidelines we need you to follow conventional commit so please edit the message as fix(subject): message or fix: message

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 76.47%. Comparing base (47fd185) to head (aa3325b).
⚠️ Report is 7 commits behind head on develop.

Additional details and impacted files
@@           Coverage Diff            @@
##           develop    #2686   +/-   ##
========================================
  Coverage    76.47%   76.47%           
========================================
  Files          186      186           
  Lines        11700    11700           
========================================
  Hits          8947     8947           
  Misses        2753     2753           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Deduplicate the courses and batches returned by the created lists
endpoints to prevent the same item from appearing multiple times.
@zaveshaa
zaveshaa force-pushed the fix-created-courses-duplicates branch from aa3325b to 460c2c5 Compare August 26, 2026 09:19
@zaveshaa

Copy link
Copy Markdown
Author

Done — the commit message is now fix: Remove duplicate courses and batches in the created lists, following the conventional commit format. I also merged the latest develop in so the branch is up to date.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] get_created_courses() moderator fallback missing .distinct() causes duplicate course cards on Home page

3 participants