fix: single-photo analyze now looks up 5+ digit matches in canteen DB instead of showing warning

When OCR finds 5+ digits (match_5plus) but no 5-6 pattern, the frontend
now extracts the first 5 digits as the candidate machine ID, shows it,
and calls lookupAsset() to check the canteen DB — same behavior as the
5dash6 path. Eliminates the confusing '(no 5-6 pattern)' message.
This commit is contained in:
2026-05-25 20:14:49 -04:00
parent 3c3c06bd56
commit 5cda952072
4 changed files with 50 additions and 1 deletions
+3 -1
View File
@@ -818,7 +818,9 @@ async function uploadSelected() {
html += '<div style="margin-top:4px;color:var(--green);">✅ Matched: <strong>' + esc(ocr.match_5dash6) + '</strong> → machine ID: ' + mid + '</div>';
lookupAsset(mid);
} else if (ocr.match_5plus) {
html += '<div style="margin-top:4px;color:var(--amber);">⚠️ Digits: <strong>' + esc(ocr.match_5plus) + '</strong> (no 5-6 pattern)</div>';
const mid = ocr.match_5plus.replace(/[^0-9]/g,'').slice(0, 5);
html += '<div style="margin-top:4px;color:var(--amber);">🔍 Digits: <strong>' + esc(ocr.match_5plus) + '</strong> → trying ID <strong>' + mid + '</strong></div>';
lookupAsset(mid);
} else {
html += '<div style="margin-top:4px;color:var(--text3);">No machine ID found in image</div>';
}