fix: Duplikat-Recheck beim Confirm nur statement-uebergreifend
Zwei identische Buchungen im selben Auszug teilen sich den dedup_hash. Beim Confirm markierte die zuerst bestaetigte Buchung ihren Zwilling (autoflush + Clash-Select) als Duplikat und uebersprang ihn, wodurch der vom Preview gepruefte Saldo zerstoert wurde. Clash-Query um statement_id != tx.statement_id erweitert: der Re-Check schuetzt nur noch statement-uebergreifend. Test: Auszug mit zwei identischen Buchungen -> beide werden bestaetigt. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -133,6 +133,11 @@ def confirm(statement_id: int, session: Session = Depends(get_session)):
|
||||
Transaction.dedup_hash == tx.dedup_hash,
|
||||
Transaction.status == "confirmed",
|
||||
Transaction.id != tx.id,
|
||||
# Only guard against duplicates from OTHER statements. Two
|
||||
# genuinely identical bookings within the same statement share a
|
||||
# dedup_hash; the balance the preview validated depends on both
|
||||
# being confirmed, so they must not knock each other out here.
|
||||
Transaction.statement_id != tx.statement_id,
|
||||
)
|
||||
).scalar()
|
||||
if clash is not None:
|
||||
|
||||
Reference in New Issue
Block a user