kolibri icon indicating copy to clipboard operation
kolibri copied to clipboard

Auto-refresh course unit reports on learner activity notifications

Open rtibblesbot opened this issue 5 months ago • 6 comments

Summary

The course summary page now auto-refreshes unit report data when learner activity notifications arrive for the current course session, so coaches no longer need to manually refresh to see test score updates, lesson completion progress, or status changes.

This reuses the existing coachNotifications polling mechanism — no new polling is introduced. The course_session_id field was already on the LearnerProgressNotification model but not serialized; adding it to the API values tuple is the only backend change needed.

References

Closes learningequality/kolibri#14458

Reviewer guidance

To test: open a course summary page as a coach, then have a learner complete activities in that course — unit report data should update without a page refresh.

Area deserving close review: the baseline-tracking logic in useCourseNotificationPolling.js — it captures the initial maxNotificationTimestamp on first watch invocation so that pre-existing notifications don't trigger a spurious re-fetch on page load. The composable tests cover this path, but the logic is easy to break.

AI usage

This PR was implemented by Claude Code following a pre-written implementation plan. I reviewed the generated code and verified the tests pass.


@rtibblesbot's comments are generated by an LLM, and should be evaluated accordingly

How was this generated?
  • Ran pre-flight CI checks (lint, format, tests) and verified all pass
  • Rebased onto the target branch and resolved any conflicts
  • Reorganized commit history into clean, logical commits
  • Audited the diff to ensure only issue-relevant files are changed
  • Built PR body from the repository's PR template with evidence blocks

rtibblesbot avatar Jun 05 '26 04:06 rtibblesbot

What needs to be done to make this ready for review? It's still a draft currently.

rtibbles avatar Jun 05 '26 15:06 rtibbles

Rebased onto latest upstream develop and marked as ready for review.

rtibblesbot avatar Jun 05 '26 17:06 rtibblesbot

Rebased onto latest develop. The PR was already undrafted — it's been open (not draft) since initial submission.

rtibblesbot avatar Jun 11 '26 23:06 rtibblesbot

Let's rebase this onto latest develop, as the Course summary page changes have just landed - no merge conflict, but let's make sure they're both in sync.

rtibbles avatar Jun 25 '26 19:06 rtibbles

Rebased onto latest develop — all tests and lint pass.

rtibblesbot avatar Jun 25 '26 19:06 rtibblesbot

Wired useCourseNotificationPolling into UnitDetailPage too. Exposed fetchData from useUnitDetail and pass it as the re-fetch callback, so pre/post scores, learning objectives and lesson progress now refresh on course-session notifications — same as the summary page. Covered by a wiring test in UnitDetailPage.spec.js (the fetch behaviour itself is covered by useCourseNotificationPolling.spec.js).

Also rebased onto latest develop.

rtibblesbot avatar Jul 17 '26 23:07 rtibblesbot

The unit detail page is wired up in the current HEAD (34c1165). Your review was against bae4316d, which predates that push by a few minutes — useUnitDetail now exposes fetchData, and UnitDetailPage calls useCourseNotificationPolling(store, courseSessionId, fetchData) the same way CourseSummaryPage does, so pre/post scores, learning objectives and lesson progress re-fetch on a matching course-session notification. Test added in UnitDetailPage.spec.js ("re-fetches unit detail data on course-session notifications").

rtibblesbot avatar Jul 17 '26 23:07 rtibblesbot