fix(receipt-import): upgrade confidence level for next suggestion based on rule application

This commit is contained in:
Nils-Johan Gynther
2026-05-02 23:36:19 +02:00
parent b7d68afd58
commit f108034742
@@ -349,7 +349,10 @@ export class ReceiptImportService {
if (byRule?.confidence === 'high') {
const sameAsCurrent =
nextSuggestion != null && nextSuggestion.categoryId === byRule.categoryId;
if (!sameAsCurrent && (!isTrustedSuggestion || nextSuggestion == null)) {
if (sameAsCurrent && nextSuggestion && nextSuggestion.confidence !== 'high') {
nextSuggestion = { ...nextSuggestion, confidence: 'high' };
pushTrace(`rule applied -> "${byRule.path}" (confidence upgraded to high)`);
} else if (!sameAsCurrent && (!isTrustedSuggestion || nextSuggestion == null)) {
nextSuggestion = byRule;
pushTrace(`rule applied -> "${byRule.path}"`);
}