Paginate activity history and aggregate dashboard totals in SQL
This commit is contained in:
@@ -63,3 +63,30 @@ HTTP 200 and `status: ok`; Dokku web and sync worker startup checks succeeded.
|
||||
The synthetic browser fixture verified dashboard replay, route colour switching
|
||||
and charts. Its in-memory SQLite server uses one request thread to avoid concurrent
|
||||
access to the shared SQLite connection.
|
||||
|
||||
## Paginated history
|
||||
|
||||
Dashboard, shared profiles and the friends feed show 25 activities per page,
|
||||
ordered by start time descending with activity ID as the tie-breaker. Navigation
|
||||
preserves profile URLs and returns to the history section. Invalid or empty
|
||||
out-of-range pages return 404; an empty first page remains valid.
|
||||
|
||||
Dashboard and profile totals are SQL aggregates over the entire authorized
|
||||
history. Eight weekly buckets use independent local-time Monday boundaries
|
||||
converted to UTC, including daylight-saving changes. The latest GPS run is an
|
||||
independent indexed query, so paging does not change the map. Friend/profile
|
||||
filters apply equally to pagination, counts, totals and route selection.
|
||||
|
||||
Personal record comparisons stream only ID, title, timestamp, sport, calculation
|
||||
version and stored efforts in batches of 1,000. They retain at most six current
|
||||
record holders and effort details for the requested page (or one run's detail).
|
||||
No full-history Activity ORM objects, raw samples, charts or laps are loaded.
|
||||
Comparisons remain linear in the number of recorded runs; page rows and ORM
|
||||
object counts are bounded. Owners are loaded with the page to avoid per-row
|
||||
athlete queries. Composite indexes support owner/date and shared owner/date lists.
|
||||
|
||||
A disposable local SQLite benchmark with 10,000 synthetic activities returned
|
||||
25 rows and 26 ORM objects on pages 1, 200 and 400. HTML remained about 30 KiB;
|
||||
measured request times were 148, 122 and 97 ms respectively. These are synthetic
|
||||
local measurements, not production latency guarantees. Browser checks with 55
|
||||
synthetic activities verified pages 1–3, including the five-row final page.
|
||||
|
||||
Reference in New Issue
Block a user