orders: badge the annual summary receipts (board 211)
ci / lint-test (push) Successful in 40s

Migration 033 adds entity_orders.summarises_period; order_spend drops those
rows and order_feed keeps them. Unbadged, a $2,376 annual tax receipt
restating twelve monthly donations renders as the largest single purchase of
the year, so both surfaces say what it is:

- /orders  — a "year summary" chip beside the auth badges
- /orders/<key> — a banner in the same shape as the settled-rail one, saying
  the monthly debits are in the ledger under their own dates

The amount is deliberately still shown. It is the year's giving total and the
reason the row is worth keeping; it just belongs to no total on the page. The
detail page already falls back to o.order_total when order_spend has no row,
which is exactly the case now — verified: gross_total null, order_total 2125.5.
This commit is contained in:
2026-08-12 20:12:36 +10:00
parent 231ef3411a
commit 6b9b5fe518
3 changed files with 39 additions and 1 deletions
+11 -1
View File
@@ -79,6 +79,12 @@ export interface OrderRow {
* every order here came from email. */
auth_verdict: string | null;
injection_flagged: boolean | null;
/** An annual tax/donation receipt restating a year of payments already made,
* not a purchase (board 211). It stays on this page — the figure is the
* year's giving total and is worth seeing — but `order_spend` excludes it,
* so the amount here is deliberately NOT part of any total on the page.
* Badge it, or a $2,376 row reads as a single purchase. */
summarises_period: boolean;
txn_count: number;
first_txn_id: number | null;
}
@@ -239,7 +245,7 @@ export async function getOrderFeed(filters: OrderFilters) {
f.ordered_at, f.eta_date, f.delivered_at,
f.currency, f.order_total, f.line_item_count,
f.content_class, f.display_name, f.cadence_days,
f.auth_verdict, f.injection_flagged,
f.auth_verdict, f.injection_flagged, f.summarises_period,
m.canonical_name AS merchant_name,
link.txn_count, link.first_txn_id,
(SELECT sp.refunded_amount FROM order_spend sp
@@ -378,6 +384,9 @@ export interface OrderDetail {
tracking_carrier: string | null;
line_items: { description?: string; quantity?: number; amount?: number }[];
is_settled_duplicate: boolean;
/** Board 211 — an annual receipt restating a year of payments already made.
* Same shape as is_settled_duplicate: browsable, excluded from spend. */
summarises_period: boolean;
content_class: string | null;
display_name: string;
cadence_days: number | null;
@@ -405,6 +414,7 @@ export async function getOrderDetail(entityKey: string): Promise<OrderDetail | n
o.order_total, o.tracking_url, o.tracking_carrier,
m.canonical_name AS merchant_name,
(o.settles_entity_id IS NOT NULL) AS is_settled_duplicate,
o.summarises_period,
COALESCE(o.details->'line_items', '[]'::jsonb) AS line_items,
sp.order_total AS net_total,
sp.gross_total,