Repository navigation
fix(reports): exclude cancelled orders and items - #1308
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configuration
You can disable this status message by setting the Use the checkbox below for a quick retry:
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 |
|
@greptileai review this at apex |
[Medium impact] The PR appears safe to merge; no new actionable issues were found, and both earlier findings are fixed.
|
7695a3c to
67bb663
Compare
|
@greptileai review this at apex |
1 similar comment
|
@greptileai review this at apex |
…rminal-item exclusions
…E2E (Shard 2/4)`, which cascaded to `End-to-End Playwright Tests` and `Required Checks Gate`): - **Invariant:** Whenever `/customer-display` is loaded under a paused Playwright clock (`clock.pauseAt` before `goto`), the test must advance the paused clock across both stages of `CustomerDisplayPage`'s mount effect chain: first `clock.runFor(1)` to fire the token-resolution `setTimeout(..., 0)` (`consumeDisplayTokenFromUrl()` / `setPairedToken(token)`), then wait for React to commit the resolved-token render (`expect(page.locator('header')).toBeVisible()`) so the polling `useEffect` registers `const initial = setTimeout(refresh, 0)`, and finally a second `clock.runFor(1)` to fire `initial`. - **Root cause & fix (`frontend/e2e/layout-integrity.spec.ts`):** Commit `3e1f60c2` added `await budgetPage.clock.pauseAt(new Date(Date.now() + 1000))` before `budgetPage.goto(...)` in `'drains multiple cursor pages, deduplicates overlapping orders, removes completed orders, and clears on follow-up page 401'`, but left only a single `await budgetPage.clock.runFor(1)` after `goto`. Under a paused clock, the first `runFor(1)` only fired the token-resolution timer; the subsequent `setTimeout(refresh, 0)` scheduled after React committed `pairedToken` never fired, hanging `await slowPage1Arrived` until the 30s timeout. Added `await expect(budgetPage.locator('header')).toBeVisible()` and `await budgetPage.clock.runFor(1)` matching the existing paused-clock pattern at lines 2067-2069. - **Verification:** Reproduced the 30s timeout locally before the fix, then verified `npx playwright test --config=playwright.config.ts --project=chromium --retries=0 e2e/layout-integrity.spec.ts -g "customer display wraps full receipt numbers and pages on TV"` (12/12 passed), `npm run lint`, `cd frontend && npx oxfmt --check e2e/layout-integrity.spec.ts`, `npm run docs:check`, and `git diff --check`
e23e8be to
585d7a2
Compare
|
@greptileai review this at apex |
1 similar comment
|
@greptileai review this at apex |
Fixes #1298
Intent
Fix the double-verified cancelled-order and voided-item reporting leakage in
main/routes/reports.tsfrom the06a30fe0audit (GitHub Issue #1298):GET /api/reports/summary(main/routes/reports.ts:253-271) queriesordersandbillswithoutAND status != 'cancelled'(andpaymentMethodBreakdowninmain/routes/cash-closures.tswithoutexcludeCancelledOrders).GET /api/reports/sales(main/routes/reports.ts:507-513, 534-541) queriesdailyRows,byOrderType, andbyPaymentMethodwithout excluding cancelled orders.GET /api/reports/topProducts(main/routes/reports.ts:577-590) queriesorder_items oi JOIN orders owithoutAND o.status != 'cancelled'and withoutAND COALESCE(oi.status, 'active') NOT IN ('cancelled', 'voided', 'void_adjustment', 'refunded').GET /api/reports/tables(main/routes/reports.ts:699-710) joinsorderswithoutAND o.status != 'cancelled'.What Changed
status != 'cancelled') fromGET /api/reports/summary(order totals, bill counts/totals, collected amounts across bills and refunds, and payment method breakdowns),GET /api/reports/sales(dailySales,byOrderType, andbyPaymentMethod), andGET /api/reports/tables(LEFT JOIN orders), via an opt-inexcludeCancelledOrdersfilter inpaymentMethodBreakdown(main/routes/reports.ts,main/routes/cash-closures.ts).cancelled,voided,void_adjustment,refunded) from product quantity, revenue, and order-count aggregations inGET /api/reports/topProducts(main/routes/reports.ts).docs/reference/api.md, add regression coverage intests/reports-insights.test.tsandfrontend/e2e/ops-admin/dashboard-reconciliation.spec.ts, and advance the paused clock after header mount infrontend/e2e/layout-integrity.spec.ts.