Skip to content

fix: suppress already-billed pending calendar events from billing and queue#150

Merged
dholbach merged 1 commit into
mainfrom
fix/suppress-already-billed-pending-events
Jul 1, 2026
Merged

fix: suppress already-billed pending calendar events from billing and queue#150
dholbach merged 1 commit into
mainfrom
fix/suppress-already-billed-pending-events

Conversation

@dholbach

@dholbach dholbach commented Jul 1, 2026

Copy link
Copy Markdown
Owner

Problem

Pending PendingCalendarEvent records 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:

  1. /billing/open/ — client appeared with "Appointments pending" warning even though the sessions were billed
  2. Calendar approval queue — the events were shown in the list with a "✓ vorhanden" badge, requiring manual "skip duplicates" to dismiss them

Fix

Billing overview (_gather_billing_data): added an Exists exclude — pending events where an InvoiceItem already 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 separate stale_count drives 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

  • Lint passes
  • test_calendar_import_helpers, test_views_invoice pass

🤖 Generated with Claude Code

… 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>
@dholbach dholbach merged commit 5356030 into main Jul 1, 2026
1 check passed
@dholbach dholbach deleted the fix/suppress-already-billed-pending-events branch July 1, 2026 12:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant