fix: replace integer comparisons on boolean fields with True/False (#69) #94
No reviewers
Labels
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: cal/major-domo-database#94
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "issue/69-boolean-fields-compared-as-integers-sqlite-pattern"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
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 == TrueTransaction.cancelled == 0→Transaction.cancelled == FalseTransaction.frozen == 1→Transaction.frozen == TrueTransaction.frozen == 0→Transaction.frozen == Falseapp/db_engine.py(lines 438, 441, 499, 502, 560, 563):Transaction.cancelled == 0→Transaction.cancelled == Falsein theget_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.
AI Code Review
Files Reviewed
app/routers_v3/transactions.py(modified — 4 occurrences)app/db_engine.py(modified — 6 occurrences)Findings
Correctness
Transaction.cancelledandTransaction.frozenare bothBooleanField(default=False)(db_engine.py:933–934). Using== True/== Falsein Peewee ORM generatesWHERE field = TRUE/FALSE— semantically correct for a boolean column.== 1/== 0worked in PostgreSQL (integer coercion) but was SQLite-era idiom mismatched to the field type. Fix is correct.cancelled == 0/1orfrozen == 0/1patterns in the changed files.Security
Style & Conventions
Transaction.cancelledfor= TRUE,~Transaction.cancelledfor= FALSE) as a slightly more idiomatic alternative, but== True/== Falseis equally correct and more readable. Not a blocker.Suggestions
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
Checkout
From your project repository, check out a new branch and test the changes.