BE: lazy SQL execution caused devIsSleeping to be missing and tiles n…#1572
BE: lazy SQL execution caused devIsSleeping to be missing and tiles n…#1572
Conversation
📝 WalkthroughWalkthroughThe Changes
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
server/db/db_helper.py (1)
99-103: Minor:devIsSleepingselected but unused in CTE.The
MyDevicesFilterCTE only needsdevMacfor theCOUNT(*)on line 113. IncludingdevIsSleepingin the SELECT clause is harmless but unnecessary since it's only referenced in the WHERE conditions (viamy_devices_clauses), not in the output.That said, the switch to
DevicesViewis correct and necessary becausedevIsSleepingis a computed column that only exists in the view, not in the baseDevicestable.Optional: Remove unused column from SELECT
MyDevicesFilter AS ( - SELECT devMac, devIsSleeping + SELECT devMac FROM DevicesView WHERE {my_devices_clauses} )🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@server/db/db_helper.py` around lines 99 - 103, The CTE MyDevicesFilter selects devIsSleeping from DevicesView but never uses it in the output (only devMac is needed for the COUNT(*) aggregation in the later query); to clean this up, remove devIsSleeping from the SELECT list in the MyDevicesFilter CTE so it only selects devMac (keep the FROM DevicesView and the my_devices_clauses filter unchanged since devIsSleeping may still be referenced in those clauses).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@server/db/db_helper.py`:
- Around line 99-103: The CTE MyDevicesFilter selects devIsSleeping from
DevicesView but never uses it in the output (only devMac is needed for the
COUNT(*) aggregation in the later query); to clean this up, remove devIsSleeping
from the SELECT list in the MyDevicesFilter CTE so it only selects devMac (keep
the FROM DevicesView and the my_devices_clauses filter unchanged since
devIsSleeping may still be referenced in those clauses).
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 9316c8fd-a1e4-46dc-82c7-06f607d7d1fc
📒 Files selected for processing (1)
server/db/db_helper.py
lol, that is the fix - if I wouldn't select it it wouldn't resolve in the subquery - add learning @coderabbitai |
|
Tip For best results, initiate chat on the files or code changes.
( ˶ˆ꒳ˆ˵ ) ✏️ Learnings added
|
…ot show #1569 #1250
Summary by CodeRabbit