fix: respect is_ai=False in get_teams filter (#22) #41

Merged
cal merged 1 commits from ai/paper-dynasty-database#22 into next-release 2026-03-03 21:42:01 +00:00
Owner

Summary

Fixes is_ai filter in get_teams endpoint to correctly handle False values.

Root Cause

all_teams.where(Team.is_ai) always evaluated as a truthy column reference, filtering for AI teams regardless of whether the caller passed is_ai=False.

Fix

Applied the same explicit boolean comparison pattern already used by the adjacent has_guide filter:

# Before
if is_ai is not None:
    all_teams = all_teams.where(Team.is_ai)

# After
if is_ai is not None:
    if not is_ai:
        all_teams = all_teams.where(Team.is_ai == False)
    else:
        all_teams = all_teams.where(Team.is_ai == True)

Files Changed

  • app/routers_v2/teams.py (lines 152–156)

Tests

No test suite in this repo. Change verified by code review — logic now matches the existing has_guide pattern and is PostgreSQL-compatible.

## Summary Fixes `is_ai` filter in `get_teams` endpoint to correctly handle `False` values. ### Root Cause `all_teams.where(Team.is_ai)` always evaluated as a truthy column reference, filtering for AI teams regardless of whether the caller passed `is_ai=False`. ### Fix Applied the same explicit boolean comparison pattern already used by the adjacent `has_guide` filter: ```python # Before if is_ai is not None: all_teams = all_teams.where(Team.is_ai) # After if is_ai is not None: if not is_ai: all_teams = all_teams.where(Team.is_ai == False) else: all_teams = all_teams.where(Team.is_ai == True) ``` ### Files Changed - `app/routers_v2/teams.py` (lines 152–156) ### Tests No test suite in this repo. Change verified by code review — logic now matches the existing `has_guide` pattern and is PostgreSQL-compatible.
cal added 1 commit 2026-03-03 21:32:20 +00:00
fix: respect is_ai=False in get_teams filter (#22)
All checks were successful
Build Docker Image / build (pull_request) Successful in 3m7s
dde9c1310f
`all_teams.where(Team.is_ai)` always filtered for AI teams regardless
of the caller's intent. Match the existing has_guide pattern and use
explicit boolean comparison so False is handled correctly.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
cal changed target branch from main to next-release 2026-03-03 21:38:25 +00:00
cal force-pushed ai/paper-dynasty-database#22 from dde9c1310f to 3e15acbb9d 2026-03-03 21:38:53 +00:00 Compare
cal merged commit 7b18962033 into next-release 2026-03-03 21:42:01 +00:00
cal deleted branch ai/paper-dynasty-database#22 2026-03-03 21:42:01 +00:00
Sign in to join this conversation.
No description provided.