diff --git a/Services/RfidService.cs b/Services/RfidService.cs index 6172563..cddf45a 100644 --- a/Services/RfidService.cs +++ b/Services/RfidService.cs @@ -333,7 +333,7 @@ public class RfidService : IRfidService .GetAwaiter() .GetResult(); - var matching = menuItems + var authorized = menuItems .Where(i => i.MenuItemId > 0) .Where(i => { @@ -352,12 +352,17 @@ public class RfidService : IRfidService }) .ToList(); - if (matching.Count == 0) + // Fallback: if employee_menu_item_tag has no matches for this employee/session, + // still allow showing the menu items fetched from HRMS menu_item. + var matching = authorized.Count > 0 + ? authorized + : menuItems.ToList(); + + if (authorized.Count == 0) { Logger.Log( - new Exception($"No authorized menu item found for card={cardId}, site={siteNumeric}, date={nowLocal:yyyy-MM-dd}, meal={mealLabel}, grade={employee.GradeType}"), + new Exception($"No employee_menu_item_tag match; using fallback menu. card={cardId}, site={siteNumeric}, date={nowLocal:yyyy-MM-dd}, meal={mealLabel}, grade={employee.GradeType}"), "RfidService.ProcessScanDetailed authorization"); - return new ScanResult(false, "No menu item selected.", 0, employee, session); } var names = matching