Skip to content

Preserve 'linked' sideload data in PaginatedList (fixes #709) - #719

Open
dylangriffinshub wants to merge 1 commit into
ucfopen:developfrom
dylangriffinshub:fix/issue-709-preserve-linked-data
Open

Preserve 'linked' sideload data in PaginatedList (fixes #709)#719
dylangriffinshub wants to merge 1 commit into
ucfopen:developfrom
dylangriffinshub:fix/issue-709-preserve-linked-data

Conversation

@dylangriffinshub

Copy link
Copy Markdown

Summary

Fixes #709. Compound-document Canvas responses (e.g. the grade change log) return a linked section with sideloaded users/courses/assignments. PaginatedList discarded this data whenever _root was set, so callers lost the objects needed to resolve identifiers such as sis_user_id without making extra API calls.

Changes

  • Collect the linked section from the original response before any _root extraction.
  • Merge sideloaded objects across every page, deduplicating by id.
  • Expose the collected data through a read-only linked property on PaginatedList.
  • Add fixtures and tests for both single-page and multi-page compound documents.

Example

```python
events = course.get_grade_change_events()
for event in events:
...

sideloaded users/courses/assignments are now available:

events.linked["users"] # -> [{"id": "U1", "name": "Alice"}, ...]
events.linked["courses"] # -> [{"id": "C1", "name": "Math"}]
```

Backward compatible: responses without a linked section return an empty dict. All existing test_paginated_list / test_grade_change_log tests still pass, plus 2 new tests.

Closes #709

Compound-document Canvas responses (e.g. the grade change log) return a
'linked' section with sideloaded users/courses/assignments. PaginatedList
discarded it when _root was set, so callers lost the data needed to resolve
identifiers like sis_user_id without extra API calls.

- Collect 'linked' from the original response before _root extraction
- Merge sideloaded objects across all pages (dedup by id)
- Expose via a read-only  property
- Add fixtures + tests for single-page and multi-page cases

Fixes ucfopen#709
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.

Grade Change Log (assignment.get_grade_change_events()) discards "linked" data

1 participant