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