Answer canRefund from the lines the page already loaded - #2093
Conversation
The attendee page loaded every one of the attendee's booking lines, then asked the database again whether one of those same lines was a real booking on the listing. The answer was already in hand. Both loads still run together, so this drops a round trip without making anything wait longer. The decision is now a pure function over facts the page holds. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AXUnTqyoPzb4VPSsyLwk69
Fails without the change: the existence query shows up in the recorded statements. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AXUnTqyoPzb4VPSsyLwk69
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
Included review availability: 1 review is currently available. Based on recent review activity, included reviews refill at 4 per hour. 📝 WalkthroughWalkthroughRefund eligibility now uses already-loaded attendee lines instead of a separate booking-line query. Payment references and attendee lines load in parallel. A regression test verifies that ChangesAttendee refund eligibility
Estimated code review effort: 2 (Simple) | ~10 minutes Merge Risk: ⚪ Minimal · up to The PR removes a redundant database round trip while preserving the refund decision for quantity-bearing lines; no actionable merge-blocking risk remains beyond normal checks and review. Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
✨ Simplify code
Comment |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Answer canRefund from the lines the page already loaded
Fourth of a short series of small changes that cut wasted database round trips, found by profiling real requests.
What was happening
The attendee page loads every one of that attendee's booking lines. Then, to decide whether to offer the Refund button, it asked the database again:
That question was already answered by the rows in hand.
The change
The decision reads the lines the page loaded rather than asking again. Both loads still run together, so this drops a round trip without making anything wait longer, and deciding whether a refund can be offered is now a small pure function over facts the page already holds.
The distinction the original query existed to protect is kept exactly. It checked the exact attendee-and-listing row rather than an arbitrary joined sibling, and excluded no-quantity placeholder lines, so a line marked no-quantity stops offering the refund. The in-memory check does the same: it looks for a line on that listing with a real quantity.
What it saves
One round trip on every attendee page load — the actions tab, the edit form, and every other tab, since they share this loader.
Tests
🤖 Generated with Claude Code
https://claude.ai/code/session_01AXUnTqyoPzb4VPSsyLwk69
Generated by Claude Code
Summary by CodeRabbit