fix: suppress already-billed pending calendar events from billing and queue#150
Merged
Merged
Conversation
… queue Pending calendar events for sessions that are already billed were surfacing as false alarms in /billing/open/ and cluttering the calendar approval queue. - _gather_billing_data: exclude pending events where a matching InvoiceItem already exists (same client, same date, duration ±5 min) - calendar_approval_queue: filter out already-billed events from the listing; pass stale_count separately so the banner still offers a one-click cleanup (mark as skipped) - Remove per-row duplicate badge (events no longer appear in list) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Pending
PendingCalendarEventrecords for sessions that were already billed (e.g. manually created and invoiced without going through the import flow) showed up as false alarms in two places:/billing/open/— client appeared with "Appointments pending" warning even though the sessions were billedFix
Billing overview (
_gather_billing_data): added anExistsexclude — pending events where anInvoiceItemalready exists for the same client/date/duration (±5 min, excluding cancelled invoices) are no longer counted as unresolved.Calendar queue (
calendar_approval_queue): already-billed events are filtered out of the listing entirely. A separatestale_countdrives a subtle info banner ("N events hidden — mark as done") so the user can still clean up the DB state with one click.Test plan
test_calendar_import_helpers,test_views_invoicepass🤖 Generated with Claude Code