WFDASH-WEBAPP/src/app
Dave f44258667c fix(orders): search silently dropped the newest active orders
Searching for a supplier returned nothing even though the order existed
with that supplier set and "TRUCO" in the line description.

Root cause is not search coverage — it's a stale safety cap. The search
path fetched the active candidate set with a fixed `perPage: 500`, on the
comment's reasoning: "91 active orders out of 4,782, so the cap is
unreachable in practice." Measured on live PB 2026-10-14 the active set
is 610 orders. Because /api/v1/orders/list sorts `created` ASCENDING
(oldest first, so the buyer works the queue top-down), the slice kept
the 500 oldest and silently discarded the 110 newest.

Verified against live PB before the fix:
  truco     -> 0 matches
  skirting  -> 0 matches
  tiaan     -> 57 matches
After:
  truco     -> 1 match  (ORD-26-10-13-SCALPERS, collection_pool)
  skirting  -> 1 match
  tiaan     -> 76 matches  (19 were being dropped too)

It presented as "some searches work and some don't": only matches on
OLD orders survived, so it looked like a missing supplier field rather
than truncation, and the supplier lookup added in efb5a53 inherited the
bug rather than causing it.

Fix: `perPage: activeIds.length` so the candidate set is never sliced.
The set is already bounded by COMPLETED_WINDOW_DAYS plus the non-terminal
statuses, so it grows with daily throughput, not total history.

Regression test seeds 520 active orders with the needle on the newest,
so an ascending sort puts it past the old cap. Verified it FAILS against
the old code and passes against the new.
2026-10-14 09:51:46 +02:00
..
(app) feat(orders): search by supplier, SKU and forgiving prices 2026-10-14 09:15:39 +02:00
(auth)
(counter) fix(pwa): restore apple-mobile-web-app-capable so iOS installs standalone 2026-09-06 21:56:01 +02:00
(mobile) feat(mobile-dashboard): add light/dark toggle, switch accent to red, bigger numbers 2026-09-07 15:02:10 +02:00
(print) feat: implement discount functionality in POS system 2026-09-03 12:19:21 +02:00
(rep)/rep feat(rep): add /rep/visits map with heatmap, per-customer clusters 2026-09-20 23:50:03 +02:00
(tv)
api fix(orders): search silently dropped the newest active orders 2026-10-14 09:51:46 +02:00
scan fix(scan): speed up QR recognition and keep scanning 2026-10-05 09:43:53 +02:00
favicon.ico
globals.css feat: implement discount functionality in POS system 2026-09-03 12:19:21 +02:00
layout.tsx fix(pwa): restore apple-mobile-web-app-capable so iOS installs standalone 2026-09-06 21:56:01 +02:00
offline.tsx
page.tsx