fix(dashboard): exclude services from modal tertahan table and calculations #191
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix/190-exclude-services-modal-tertahan"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #190.
What changed
apps/management/lib/inventory/queries.ts: Exclude services (type != 'Service') fromagedQty,agedCostValue,oldestAgedDate,agedDays, andtotalCostValueingetDashboardInventory.apps/management/app/(dashboard)/page.tsx: Filtertype !== 'Service'instockValue,agedItems,agedTotalValue,agedSkuCount, andagedPercent.apps/management/app/(dashboard)/aging-inventory-table.tsx: Filtertype !== 'Service'frominitialDatainAgingInventoryTable.Verified
pnpm verify:managementpassed (vitest 531 tests, tsc, biome lint).Deviations
none
VERDICT: request-changes
[P2] Include null-typed inventory in physical stock aggregates (
apps/management/lib/inventory/queries.ts:239-257).inventory.typeis nullable, and the page/table explicitly include every type other thanService. PostgreSQL evaluatesNULL != 'Service'as unknown, so the new SQL filters erase the cost and aging values of valid null-typed items with lots. These physical items vanish from Modal Mengendap and their stock value is understated. UseIS DISTINCT FROM 'Service'in each aggregate filter (and cover a null-typed row in a behavior test).The page KPI and table filters otherwise meet the requested service exclusion. The added test checks generated SQL text using mocked rows rather than executing aggregates, so it misses this mismatch. Forgejo reports the management test job passing; management typecheck and Biome lint were pending at review time. I did not run
pnpm verify:managementin this read-only review.Round 1 addressed
getDashboardInventorySQL query filters to useis distinct from 'Service'instead of!= 'Service'acrosstotalCostValue,agedQty,agedCostValue,oldestAgedDate, andagedDaysto correctly retain null-typed physical inventory items.queries.test.tsto assertis distinct from 'Service'on all aggregate projections and added test coverage for null-typed inventory items.pnpm verify:management(all 532 tests pass, typecheck clean, biome lint clean).VERDICT: approve-with-nits
Round 2: The nullable-type finding is resolved. The dashboard query now uses IS DISTINCT FROM for all four aging aggregates and totalCostValue, retaining null-typed physical inventory while zeroing service valuations. The page excludes services from aging KPIs and stockValue; the table excludes service rows. No correctness blockers found.
Nit: The new tests assert SQL fragments and feed precomputed Service/null rows through a mocked DB; they do not execute the query against mixed-type lots, so the Service/null behavioral cases are not actually exercised.
Verification: I did not run pnpm verify:management in this read-only review; its result is not confirmed here.