Skip to content

[Spoiler Alert!] feat: Add Rating sample - #44

Draft
kdmccormick wants to merge 1 commit into
mainfrom
kdmccormick/rating
Draft

[Spoiler Alert!] feat: Add Rating sample#44
kdmccormick wants to merge 1 commit into
mainfrom
kdmccormick/rating

Conversation

@kdmccormick

@kdmccormickkdmccormick commented May 14, 2026

Copy link
Copy Markdown
Member

Backend:

  • UnitRating (per-user 1-5 star rating of a unit; uses opaque_keys UsageKeyField) and CourseAverageRating (cached per-course aggregate kept in sync incrementally on writes, fully recomputed on full course publish).
  • DRF endpoints at /api/v1/unit-rating/ and /api/v1/course-average-rating/.
  • Second filter pipeline step on Learner Home /init injects averageStars and ratingCount onto each courseRun, alongside the existing isArchivedByLearner.
  • XBLOCK_PUBLISHED handler recomputes only when block_type == "course" so unit/section publishes don't re-aggregate.
  • Admin registrations for both new models.

Frontend:

  • RateThisContent: per-unit star widget for frontend-app-learning's sequence_container.v1 slot.
  • CourseCardRating: per-course average display, embedded inside the Archive CourseList card (rather than the platform course-card slot). Renders "(N ratings)" even at 0 so the wiring is visibly working before any ratings exist.

Tutor plugin:

  • Second PLUGIN_SLOTS entry registers RateThisContent in the learning MFE, next to the existing learner-dashboard course_list slot.

Frontend README:

  • env.config.jsx instructions rewritten around a single shared file that covers both slots and gets copied into each MFE root.

A handful of @@TODOs remain in-code for follow-up POC cleanup.


Authored by Claude with guidance and feedback from me. I haven't reviewed all of this myself yet. After the sample-plugin workshop at the conference, we'll address @@TODOs, fully review the code, and merge.

@codecov

codecovBot commented May 14, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 81.87%. Comparing base (e7a17d1) to head (b3aa4d9).

Additional details and impacted files
@@ Coverage Diff @@## main #44 +/- ##
===========================================
- Coverage 93.04% 81.87% -11.17% 
===========================================
Files 16 16 Lines 503 673 +170 Branches 18 33 +15 ===========================================
+ Hits 468 551 +83 - Misses 24 111 +87 
Partials 11 11 
FlagCoverage Δ
unittests81.87% <ø> (-11.17%)⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 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.

Backend:
- UnitRating (per-user 1-5 star rating of a unit; uses opaque_keys
UsageKeyField) and CourseAverageRating (cached per-course aggregate
kept in sync incrementally on writes, fully recomputed on full course
publish).
- DRF endpoints at /api/v1/unit-rating/ and /api/v1/course-average-rating/.
- Second filter pipeline step on Learner Home /init injects averageStars
and ratingCount onto each courseRun, alongside the existing
isArchivedByLearner.
- XBLOCK_PUBLISHED handler recomputes only when block_type == "course"
so unit/section publishes don't re-aggregate.
- Admin registrations for both new models.
Frontend:
- RateThisContent: per-unit star widget for frontend-app-learning's
sequence_container.v1 slot.
- CourseCardRating: per-course average display, embedded inside the
Archive CourseList card (rather than the platform course-card slot).
Renders "(N ratings)" even at 0 so the wiring is visibly working
before any ratings exist.
Tutor plugin:
- Second PLUGIN_SLOTS entry registers RateThisContent in the learning
MFE, next to the existing learner-dashboard course_list slot.
Frontend README:
- env.config.jsx instructions rewritten around a single shared file
that covers both slots and gets copied into each MFE root.
A handful of @@todos remain in-code for follow-up POC cleanup.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for freeto 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.

1 participant

@kdmccormick