feat: enhance ingredient matching rules with keyword matching and add chocolate detection
Test Suite / test (24.15.0) (push) Has been cancelled
Test Suite / test (24.15.0) (push) Has been cancelled
This commit is contained in:
@@ -68,12 +68,11 @@ function hasPorkLikeSignal(normalized: string): boolean {
|
||||
normalized.includes('bacn') ||
|
||||
normalized.includes('baco') ||
|
||||
/\bbac[a-z0-9]{1,5}\b/.test(normalized) ||
|
||||
/\bsidflask\b/.test(normalized) ||
|
||||
/\bpancetta\b/.test(normalized) ||
|
||||
/\bflask\b/.test(normalized) ||
|
||||
/\bflaskfile\b/.test(normalized) ||
|
||||
/\bkarr[eé]\b/.test(normalized) ||
|
||||
/\bkotlett\b/.test(normalized)
|
||||
normalized.includes('sidflask') ||
|
||||
normalized.includes('pancetta') ||
|
||||
normalized.includes('flask') ||
|
||||
normalized.includes('karre') ||
|
||||
normalized.includes('kotlett')
|
||||
);
|
||||
}
|
||||
|
||||
@@ -699,6 +698,24 @@ export class ReceiptImportService {
|
||||
if (hit) return hit;
|
||||
}
|
||||
|
||||
// ── Regel: Choklad & spreads (Nutella, sjokolade, m.m.) ─────────────
|
||||
const hasChocolateSignal =
|
||||
normalized.includes('nutella') ||
|
||||
normalized.includes('chocolate') ||
|
||||
normalized.includes('choklad') ||
|
||||
normalized.includes('sjokolade') ||
|
||||
normalized.includes('kakao') ||
|
||||
normalized.includes('spreads');
|
||||
|
||||
if (hasChocolateSignal) {
|
||||
const chocolate = findCategory({
|
||||
name: 'choklad & spreads',
|
||||
includes: 'sötsaker',
|
||||
});
|
||||
const hit = toSuggestion(chocolate, 'high');
|
||||
if (hit) return hit;
|
||||
}
|
||||
|
||||
// ── Regel: Korvfamiljen ─────────────────────────────────────────────
|
||||
const hasSausageSignal =
|
||||
/\bkorv\b/.test(normalized) ||
|
||||
|
||||
Reference in New Issue
Block a user