Compare commits

...

2 Commits

Author SHA1 Message Date
Cal Corum
dbc24d0365 fix: ensure count is never null in GET /refractor/cards (#182)
Peewee's .count() on a complex multi-join query can return None when the
result wrapper yields an empty cursor for a 0-row result set.  Guard with
`or 0` so the response contract (count is always an integer) is upheld.

Note: tier values outside 0–4 already return 422 via FastAPI's ge/le
constraints on the tier parameter, so the reproduced scenario
(tier=99 → count: null) is also covered by validation.

Closes #182

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-06 06:28:30 +00:00
Cal Corum
75b26ecabb docs: fix dev PostgreSQL container/db/user in CLAUDE.md
Dev environment uses sba_postgres container, paperdynasty_dev database,
sba_admin user — not pd_postgres/pd_master as previously documented.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-06 06:28:30 +00:00
2 changed files with 2 additions and 2 deletions

View File

@ -31,7 +31,7 @@ docker build -t paper-dynasty-db . # Build image
| **URL** | pddev.manticorum.com | pd.manticorum.com |
| **Host** | `ssh pd-database` | `ssh akamai``/root/container-data/paper-dynasty` |
| **API container** | `dev_pd_database` | `pd_api` |
| **PostgreSQL** | `pd_postgres` (port 5432) | `pd_postgres` |
| **PostgreSQL** | `sba_postgres` / `paperdynasty_dev` / `sba_admin` | `pd_postgres` / `pd_master` |
| **Adminer** | port 8081 | — |
| **API port** | 816 | 815 |
| **Image** | `manticorum67/paper-dynasty-database` | `manticorum67/paper-dynasty-database` |

View File

@ -211,7 +211,7 @@ async def list_card_states(
if evaluated_only:
query = query.where(RefractorCardState.last_evaluated_at.is_null(False))
total = query.count()
total = query.count() or 0
items = []
for state in query.offset(offset).limit(limit):
player_name = None