history.queries
Overview
The queries behind the action-grouped history response.
A page is a page of actions, not of events, so grouping happens in the database before the paginator sees anything. That takes two reads: one for the page of groups, and one for the events belonging to those groups. Neither grows with the number of events on the page.
action_groups_for
One row per action, newest first, ready to paginate.
Actions that share a recorded time break the tie on their earliest event's identifier parts, the tracked model label and then the numeric event id, which is the published rule. That keeps a page boundary in the same place between requests without comparing identifiers as strings, where :9 would sort after :10.
Signature
action_groups_for(instance, user)
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| instance | yes | ||
| user | yes |
Source
server/vueda/history/queries.py:50
events_in_groups
Every visible event of the named groups, in the order they were written.
Each event carries the moment of its own write, so the recorded time orders a group faithfully. The tracked model label and the event id break a tie, which keeps a rendered group from reshuffling between requests.
Signature
events_in_groups(instance, user, group_keys)
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| instance | yes | ||
| user | yes | ||
| group_keys | yes |
Source
server/vueda/history/queries.py:70
Source
server/vueda/history/queries.py