Repository navigation
fix(kds): inherit subcategory station routing - #1508
Conversation
Expand parent category assignments on kitchen stations and chef accounts to include active child subcategories across KDS and KOT printer routing, while preserving explicit subcategory overrides on other stations. Clarify the unrestricted all-categories state in Kitchen Station settings cards and dialogs, and add a 1-click toggle to clear specific category restrictions.
…tricted KDS category scope
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the
|
PR Summary by QodoInherit subcategory kitchen routing and clarify all-category stations
AI Description
Diagram
High-Level Assessment
Files changed (41)
|
Code Review by Qodo
1.
|
Route unmatched KOT items to the first active unrestricted station with a configured printer before falling back to the default kitchen printer. Exclude child subcategories explicitly claimed by another active kitchen station when expanding a station's parent category on KDS, and update Telugu stationNoCategories.
Intent
Fix the two Kitchen Station and subcategory KDS/KOT routing gaps identified when investigating why newly created categories or subcategories fail to appear on Kitchen Display (KDS):
categories.parent_id): when a parent category is assigned to a Kitchen Station (kitchen_stations.category_ids) or a chef (users.category_ids), items in its child subcategories must automatically route to that station on KDS (getKdsStationCategoryIdsandgetKdsStationRoutingScopeinmain/db.ts, plus chefuserCategoryIdsfiltering) and to that station's KOT printer (routeItemsToStationsinmain/routes/printers.ts), while letting an explicit subcategory assignment on another station take precedence inrouteItemsToStations.frontend/src/app/(dashboard)/settings/page.tsx: in the backend (getKdsStationRoutingScope), leavingcategory_idsempty ([]) on a station makes it unrestricted (routing all current and future categories to that station), whereas the Settings UI currently labels an empty selection asstationNoCategories("No categories assigned"), tricking single-station owners into checking every existing category and accidentally hiding any category they create later. Make the unrestricted/all-categories state explicit in the Kitchen Station card and modal (including a clear 1-click "All categories" / clear-selection toggle in the station dialog so operators know that leaving specific categories unchecked routes all current and future categories).What Changed
expandCategoryIdsWithSubcategories,getKdsStationCategoryIds,getKdsStationRoutingScope, and KDS/kitchen/order-item routes) so non-deleted child subcategories inherit parent category routing unless explicitly assigned to another active kitchen station.routeItemsToStationsinmain/routes/printers.tsto match explicit category stations first, parent category stations second, and active unrestricted stations (category_ids: []) with a configured non-WebUSB printer third before falling back to the default kitchen printer.stationNoCategories) across all locales to represent all current and new categories, and added an explicit "All categories (including new ones)" toggle and clear action to the Kitchen Station settings form.Risk Assessment
✅ Low: The changes cleanly implement parent-to-subcategory inheritance with explicit child-station override precedence and unrestricted station routing across KDS and KOT printing paths, matching all requirements in the user intent.
Testing
Ran focused backend routing, KDS integration, and 30-locale translation checks (
test:issue-134-routing,test:issue-134-mgmt,test:server-app-station-routing,test:kds-integration,test:kds-broadcast-grouping,i18n:check), built the backend and static frontend (npm run build && npm run build:frontend), and drove all four live scenarios against the running Main API, standalone KDS server, and Chromium UI with visual screenshots and ESC/POS KOT capture; all checks and live scenarios passed.Evidence: Live KDS and KOT station routing verification report
{ "scenario1_settingsUiAllCategories": { "stationName": "Main Line", "persistedCategoryIds": [] }, "scenario2_subcategoryInheritance": { "parentCategoryId": "cat-bev", "childSubcategoryId": "5wox4o", "childProductName": "Espresso", "barChefKitchenOrdersItems": ["Espresso"], "barStationDisplayItems": ["Espresso"], "chefAdvanceEspressoStatus": 200, "chefAdvanceBurgerStatusBlocked": 403, "barPrinterKotText": "KITCHEN ORDER TICKET\n\nStation: Bar\nOrder #ORD-20261107-0001\nType: Dine in\nTime: 4:04:28 PM\n \n\n1x Espresso\n\n " }, "scenario3_explicitSubcategoryOverride": { "stationA_BarItemsOnKds": ["Cola"], "stationB_CoffeeBarItemsOnKds": ["Espresso"] }, "scenario4_unrestrictedStationPrinterRouting": { "barPrinterDispatches": 1, "coffeePrinterDispatches": 1, "mainLineUnrestrictedPrinterDispatches": 1, "defaultFallbackPrinterDispatches": 0 } }Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
✅ **Review** - passed
✅ No issues found.
✅ **Test** - passed
✅ No issues found.
npm run test:issue-134-routingnpm run test:issue-134-mgmtnpm run test:server-app-station-routingnpm run test:kds-integrationnpm run test:kds-broadcast-groupingnpm run i18n:checknpm run build && npm run build:frontendnode tests/run-electron-node-test.cjs /tmp/validate-kds-station-routing.cjs✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.