Fix ignored order_by() call in stratgame.py #24

Closed
opened 2026-02-20 06:49:58 +00:00 by cal · 1 comment
Owner

app/routers_v3/stratgame.py:94-97 — Peewee's order_by() returns a new queryset; it does not sort in place. Both branches discard the return value. Games are never sorted in GET /api/v3/games regardless of the sort parameter.

Priority: high | Labels: bug

`app/routers_v3/stratgame.py:94-97` — Peewee's `order_by()` returns a new queryset; it does not sort in place. Both branches discard the return value. Games are never sorted in `GET /api/v3/games` regardless of the `sort` parameter. **Priority**: high | **Labels**: bug
Author
Owner

Fixed in PR #39.

Root cause: order_by() in Peewee returns a new queryset — it does not mutate in place. Both branches were calling all_games.order_by(...) without assigning the result back, so the ORDER BY clause was silently discarded and games were always returned in insertion order.

Fix: changed both branches to all_games = all_games.order_by(...) in app/routers_v3/stratgame.py.

Fixed in PR #39. Root cause: `order_by()` in Peewee returns a new queryset — it does not mutate in place. Both branches were calling `all_games.order_by(...)` without assigning the result back, so the ORDER BY clause was silently discarded and games were always returned in insertion order. Fix: changed both branches to `all_games = all_games.order_by(...)` in `app/routers_v3/stratgame.py`.
cal closed this issue 2026-03-03 01:29:29 +00:00
Sign in to join this conversation.
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: cal/major-domo-database#24
No description provided.