Merge pull request 'fixes' (#8) from fixes into main

Reviewed-on: #8
pull/9/head^2
SYED MUSTUFA AHMED NAQVI 2026-04-09 06:46:29 +00:00
commit fe36ba60e0
1 changed files with 9 additions and 4 deletions

View File

@ -333,7 +333,7 @@ public class RfidService : IRfidService
.GetAwaiter() .GetAwaiter()
.GetResult(); .GetResult();
var matching = menuItems var authorized = menuItems
.Where(i => i.MenuItemId > 0) .Where(i => i.MenuItemId > 0)
.Where(i => .Where(i =>
{ {
@ -352,12 +352,17 @@ public class RfidService : IRfidService
}) })
.ToList(); .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( 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"); "RfidService.ProcessScanDetailed authorization");
return new ScanResult(false, "No menu item selected.", 0, employee, session);
} }
var names = matching var names = matching