kolibri icon indicating copy to clipboard operation
kolibri copied to clipboard

Course lesson and resource notifications never appear for learners on a learn-only device

Open rtibblesbot opened this issue 1 month ago • 3 comments

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

Target branch: develop

Observed behavior

  • A learner on a learn-only device (LOD) starts and completes resources in a course lesson, then syncs.
  • After a successful sync, Coach > Class home and Class activity show no started/completed rows for those course resources or lessons.
  • The same activity on a full device produces the rows; course pre/post-test rows do arrive after a LOD sync.
  • Reported by pcenov in https://github.com/learningequality/kolibri/pull/15304#issuecomment-5798341324 on Android, Windows and Mac LODs.

Errors and logs

  • Server: https://github.com/user-attachments/files/32569361/server-logs.zip
  • LOD: https://github.com/user-attachments/files/32569366/lod-logs.zip

User-facing consequences

Coaches whose learners use learn-only devices see no course lesson or resource progress in the activity feed, so they cannot follow those learners' work in a course.

Steps to reproduce

  1. On a server, create a class with a learner and assign a course session to the class.
  2. On the server's course page, end the pre-test.
  3. Set up a LOD for that learner and sync it. As the learner, open a course lesson and start and complete a resource in it.
  4. Sync the LOD.
  5. On the server, open Coach > <class> > Class activity.

Context

  • Synced logs reach notifications through batch_process_summarylogs and batch_process_attemptlogs, which find assignments with get_assignments: https://github.com/learningequality/kolibri/blob/584b08a7594610b076dae5b2e4d2d18045c7743d/kolibri/core/notifications/api.py#L36-L60
  • get_assignments matches only classic Lesson rows. On a full device, the course row gets its course_session_id from the progress-tracking request instead, which a synced ContentSummaryLog does not carry: https://github.com/learningequality/kolibri/blob/584b08a7594610b076dae5b2e4d2d18045c7743d/kolibri/core/logger/viewsets/progress_tracking.py#L331-L346
  • Pre/post-tests avoid the gap via _resolve_prepost_test_course_session_id.

Acceptance Criteria

  • [ ] After a LOD sync, a learner's started and completed course resources appear in Class activity with the course session's notification fields set, matching the rows a full device produces.
  • [ ] After a LOD sync, a completed course lesson and a learner needing help on a course exercise produce the same rows a full device produces.
  • [ ] A resource that sits in both a classic lesson and a course assigned to the learner produces rows for each, with no duplicates after repeated syncs.
  • [ ] Tests cover synced summary logs and attempt logs for course resources.

AI usage

Claude Code drafted this from pcenov's QA report after @rtibbles asked for a follow-up issue; it traced the sync path in the code and wrote the sections.

rtibblesbot avatar Oct 05 '26 00:10 rtibblesbot

Plan: A LOD sync produces the same course lesson/resource notification rows a full device produces (#15514).

  • [ ] Course rows from synced summary logs
  • [ ] Course rows from synced attempt logs
  • [ ] Self-review the produced code

Assumptions — the issue did not settle these; say so if one is wrong.

  • A synced log matches every assigned course holding its content, wherever the learner opened it; if coaches should see only in-course activity, a synced context field is needed.
  • Attempt logs on course resources get no exercise-kind filter, matching full-device parse_attemptslog; if wrong, non-exercise attempts produce course Started/Answered rows.
  • A course not imported on the server yields no rows, as on a full device; if rows are expected anyway, notifications need data that does not come from the content tree.

Written by rtibblesbot, an LLM-based coding agent.

rtibblesbot avatar Oct 05 '26 13:10 rtibblesbot

@rtibbles The plan's first assumption rests on a wrong premise: synced logs already carry the course context. ContentSessionLog.extra_fields["context"] stores course_session_id + node_id (kolibri/core/logger/viewsets/progress_tracking.py:526), it syncs, and AttemptLog.sessionlog is non-null.

Which should the sync path use?

  • A (planned, implemented, uncommitted): reverse-match — every active assigned course session × every course node with the log's content_id. Also emits rows for content opened outside the course, and for both classrooms when two run the same course.
  • B: read the context — attempts from attemptlog.sessionlog; summary logs from the (course_session_id, node_id) pairs in that user's session logs for the content. Rows only where the learner actually opened it in a course, as on a full device.

I'd go with B unless you see a reason not to.


Written by rtibblesbot, an LLM-based coding agent.

rtibblesbot avatar Oct 05 '26 13:10 rtibblesbot

Yes, B seems right - the only reason not to use the context is because it is not easy to query - but as we're doing this post sync, with the data available to us, we can process only the items that have that in the context.

rtibbles avatar Oct 05 '26 21:10 rtibbles