kolibri icon indicating copy to clipboard operation
kolibri copied to clipboard

Course data should be updated without needing to refresh the page

Open marcellamaki opened this issue 8 months ago • 1 comments

❌ This issue is not open for contribution. Visit Contributing guidelines to learn about the contributing process and how to find suitable issues.

Overview

The course summary and unit report pages require a manual page refresh to reflect new learner activity (test scores, lesson progress, test status changes). The coach should see updates automatically by polling the existing notifications endpoint for course-session-specific notifications and re-fetching stale data when new activity is detected.

Complexity: Medium Target branch: release-v0.19.x

Context

Original report from @pcenov:

  1. When I go to the 'Units' tab and I start or stop a test and then I go to the 'Learning objectives' tab I have to manually refresh the page to see the new state:

https://github.com/user-attachments/assets/4365d2e3-7da3-4d34-bdea-5b0a759638cd

Originally posted in https://github.com/learningequality/kolibri/issues/14440#issuecomment-4136515915

  • The existing coach notification polling system (coachNotifications Vuex module) polls the notifications endpoint with classroom_id and after timestamp, then passes new notifications to classSummary/updateWithNotifications to update in-memory status maps
  • Polling interval scales with number of coaches polling (2-20 seconds)
  • Course session notifications (#14474) will add course_session_id to notification records, enabling filtering for course-specific activity
  • This work involves changes to the course summary page and the unit detail page (#14471)

The Change

  • On course pages, watch for new notifications matching the current course_session_id from the existing notification polling
  • When course-relevant notifications arrive, re-fetch the unit report data for affected units
  • This covers test score updates, test status changes, and lesson completion progress

Out of Scope

  • Incremental in-memory updates from notification data (re-fetch is sufficient for now)
  • Applying the same pattern to lesson and quiz reports (existing class summary notification handling covers those)

Acceptance Criteria

General

  • [ ] Course pages detect new notifications matching the current course_session_id from the existing polling mechanism
  • [ ] Unit report data is re-fetched when course-relevant notifications arrive
  • [ ] Test score changes (pre/post test) are reflected without page refresh
  • [ ] Lesson completion progress updates are reflected without page refresh
  • [ ] Test status changes (activated/closed) are reflected without page refresh (these are coach actions — may require re-fetch on tab switch rather than notification polling)

Testing

  • [ ] Tests written before implementation (TDD)
  • [ ] Notification filtering by course_session_id is tested
  • [ ] Data re-fetch triggered correctly on new notifications
  • [ ] No unnecessary re-fetches when notifications are for a different course session

References

  • Original report: https://github.com/learningequality/kolibri/issues/14440#issuecomment-4136515915
  • Existing notification polling: kolibri/plugins/coach/frontend/modules/coachNotifications/index.js
  • Notification-driven updates: kolibri/plugins/coach/frontend/modules/classSummary/actions.js (updateWithNotifications)

AI usage

This issue was drafted collaboratively with Claude Code. The existing notification polling mechanism was traced to inform the integration approach.

marcellamaki avatar Mar 26 '26 22:03 marcellamaki

The bot has been waiting for a response for 2 hour(s). It will resume automatically when someone replies.

rtibblesbot avatar Jun 05 '26 06:06 rtibblesbot