Regelmäßige Bewegungen auf Ausgaben begrenzen

Berücksichtigt in der Liquiditätsprognose nur noch negative, also ausgehende, wiederkehrende Bankbewegungen aus Heuristik und KI-Erkennung.
This commit is contained in:
2026-04-23 21:18:11 +02:00
parent 5cc41f9a2d
commit 46b08b29b9

View File

@@ -157,7 +157,7 @@ const detectRecurringHeuristically = (statements: any[]): RecurringCandidate[] =
statements.forEach((statement) => {
const parsedDate = dayjs(statement.valueDate || statement.date);
if (!parsedDate.isValid()) return;
if (!parsedDate.isValid() || Number(statement.amount || 0) >= 0) return;
const partner = normalizeText(getStatementPartner(statement));
const purpose = normalizeText(statement.text).split(" ").slice(0, 5).join(" ");
@@ -236,6 +236,7 @@ const detectRecurringWithAi = async (server: FastifyInstance, statements: any[])
return (completion.choices[0].message.parsed?.candidates || [])
.filter((candidate) => dayjs(candidate.nextDate).isValid())
.filter((candidate) => Number(candidate.amount || 0) < 0)
.map((candidate) => ({
...candidate,
amount: roundMoney(candidate.amount),
@@ -270,6 +271,7 @@ const mergeRecurringCandidates = (heuristic: RecurringCandidate[], ai: Recurring
...candidate,
key: getRecurringKey(candidate),
}))
.filter((candidate) => Number(candidate.amount || 0) < 0)
.filter((candidate) => Math.abs(candidate.amount) >= 1)
.sort((a, b) => a.nextDate.localeCompare(b.nextDate));
};