fix(backend): prevent silent discarding of SQLAlchemy filters in get_campaign_rounds (#399)#500
Conversation
|
Spun this up locally to verify. Since the backend fixes the SQL filters, I ran standard HTTP requests and ran our basic tests. Looks rock solid. |
lgelauff
left a comment
There was a problem hiding this comment.
Bug confirmed and reproduced locally — get_campaign_rounds() with with_cancelled=False returns cancelled rounds because .filter() and .order_by() results were discarded. The fix is correct.
The downstream impact in build_campaign_report() is real: it takes rnds[-1] and asserts it's a ranking round — a cancelled round slipping through would cause that assert to crash the report.
The fix is minimal and correct. The existing test framework doesn't have a natural place for a DAO-level unit test, so I won't block on that. I recommend to approve.
|
@lgelauff Thanks for reproducing and verifying! I completely agreed with your point about the existing test framework being tricky for this, so I took it as a challenge. I just pushed a dedicated |
Fixes #399.
There was a bug in
get_campaign_rounds()where the SQLAlchemy.filter()and.order_by()modifications were being called but not reassigned back toq. Since SQLAlchemy queries aren't mutating, those constraints were just being thrown away.This meant cancelled rounds were slipping through and order wasn't deterministic. I updated
rdb.pyto properly reassignqso the filters persist.