feat(receipt-import): enhance receipt processing with new category rules and add unit tests

Co-authored-by: Copilot <copilot@github.com>
This commit is contained in:
Nils-Johan Gynther
2026-05-03 19:55:32 +02:00
parent 85b41f8587
commit 5b6d44b555
5 changed files with 276 additions and 5 deletions
+3 -2
View File
@@ -120,8 +120,9 @@ Regler:
? (parsed.confidence as 'high' | 'medium' | 'low')
: 'medium';
// Guardrail: för låg/medel konfidenspoäng, remmappa till L1-föräldern
if (confidence === 'low' || confidence === 'medium') {
// Guardrail: endast låg konfidens remappas till L1-förälder.
// Medium får behålla sin specifika kategori för att inte tappa precision.
if (confidence === 'low') {
const l1Name = matchedCategory.path.split(' > ')[0];
const l1 = categories.find((c) => c.path === l1Name);
if (l1 && l1.id !== matchedCategory.id) {