fix: replace integer comparisons on boolean fields with True/False (#69) #94

Open
Claude wants to merge 1 commits from issue/69-boolean-fields-compared-as-integers-sqlite-pattern into main
Collaborator

Closes #69

Summary

Replaces SQLite-era integer comparisons (== 1 / == 0) on boolean ORM fields with semantically correct Python boolean literals (== True / == False).

Changes

app/routers_v3/transactions.py (lines 78–85):

  • Transaction.cancelled == 1Transaction.cancelled == True
  • Transaction.cancelled == 0Transaction.cancelled == False
  • Transaction.frozen == 1Transaction.frozen == True
  • Transaction.frozen == 0Transaction.frozen == False

app/db_engine.py (lines 438, 441, 499, 502, 560, 563):

  • 6 occurrences of Transaction.cancelled == 0Transaction.cancelled == False in the get_roster_counts() method (active team, SIL team, LIL team blocks)

Test Results

No test suite — changes verified by reading back modified files. Diff is exactly 10 targeted lines, no reformatting.

Closes #69 ## Summary Replaces SQLite-era integer comparisons (`== 1` / `== 0`) on boolean ORM fields with semantically correct Python boolean literals (`== True` / `== False`). ## Changes **`app/routers_v3/transactions.py`** (lines 78–85): - `Transaction.cancelled == 1` → `Transaction.cancelled == True` - `Transaction.cancelled == 0` → `Transaction.cancelled == False` - `Transaction.frozen == 1` → `Transaction.frozen == True` - `Transaction.frozen == 0` → `Transaction.frozen == False` **`app/db_engine.py`** (lines 438, 441, 499, 502, 560, 563): - 6 occurrences of `Transaction.cancelled == 0` → `Transaction.cancelled == False` in the `get_roster_counts()` method (active team, SIL team, LIL team blocks) ## Test Results No test suite — changes verified by reading back modified files. Diff is exactly 10 targeted lines, no reformatting.
Claude added 1 commit 2026-03-27 09:04:21 +00:00
fix: replace integer comparisons on boolean fields with True/False (#69)
All checks were successful
Build Docker Image / build (pull_request) Successful in 2m16s
c1d1b4be51
Closes #69

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Claude added the
ai-reviewing
label 2026-03-27 09:15:53 +00:00
Claude reviewed 2026-03-27 09:17:10 +00:00
Claude left a comment
Author
Collaborator

AI Code Review

Files Reviewed

  • app/routers_v3/transactions.py (modified — 4 occurrences)
  • app/db_engine.py (modified — 6 occurrences)

Findings

Correctness

  • Transaction.cancelled and Transaction.frozen are both BooleanField(default=False) (db_engine.py:933–934). Using == True/== False in Peewee ORM generates WHERE field = TRUE/FALSE — semantically correct for a boolean column.
  • The old == 1/== 0 worked in PostgreSQL (integer coercion) but was SQLite-era idiom mismatched to the field type. Fix is correct.
  • Completeness: all 10 occurrences described in the PR body are present in the diff. Repo-wide grep confirms no remaining cancelled == 0/1 or frozen == 0/1 patterns in the changed files.

Security

  • No issues found. No user input, no new queries, no credentials.

Style & Conventions

  • No reformatting noise — diff is exactly the 10 targeted lines as claimed.
  • Note: Peewee also supports bare field expressions (Transaction.cancelled for = TRUE, ~Transaction.cancelled for = FALSE) as a slightly more idiomatic alternative, but == True/== False is equally correct and more readable. Not a blocker.

Suggestions

  • None.

Verdict: APPROVED

Clean, targeted fix. BooleanField comparisons now use proper Python boolean literals. All 10 occurrences corrected, no collateral changes.


Automated review by Claude PR Reviewer

## AI Code Review ### Files Reviewed - `app/routers_v3/transactions.py` (modified — 4 occurrences) - `app/db_engine.py` (modified — 6 occurrences) ### Findings #### Correctness - `Transaction.cancelled` and `Transaction.frozen` are both `BooleanField(default=False)` (`db_engine.py:933–934`). Using `== True`/`== False` in Peewee ORM generates `WHERE field = TRUE/FALSE` — semantically correct for a boolean column. - The old `== 1`/`== 0` worked in PostgreSQL (integer coercion) but was SQLite-era idiom mismatched to the field type. Fix is correct. - Completeness: all 10 occurrences described in the PR body are present in the diff. Repo-wide grep confirms no remaining `cancelled == 0/1` or `frozen == 0/1` patterns in the changed files. #### Security - No issues found. No user input, no new queries, no credentials. #### Style & Conventions - No reformatting noise — diff is exactly the 10 targeted lines as claimed. - Note: Peewee also supports bare field expressions (`Transaction.cancelled` for `= TRUE`, `~Transaction.cancelled` for `= FALSE`) as a slightly more idiomatic alternative, but `== True`/`== False` is equally correct and more readable. Not a blocker. #### Suggestions - None. ### Verdict: APPROVED Clean, targeted fix. BooleanField comparisons now use proper Python boolean literals. All 10 occurrences corrected, no collateral changes. --- *Automated review by Claude PR Reviewer*
Claude added the
ai-reviewed
label 2026-03-27 09:17:30 +00:00
All checks were successful
Build Docker Image / build (pull_request) Successful in 2m16s
This pull request has changes conflicting with the target branch.
  • app/db_engine.py

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin issue/69-boolean-fields-compared-as-integers-sqlite-pattern:issue/69-boolean-fields-compared-as-integers-sqlite-pattern
git checkout issue/69-boolean-fields-compared-as-integers-sqlite-pattern
Sign in to join this conversation.
No reviewers
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#94
No description provided.