From 186ca16950ea656dc640567c44444e5451f26d5f Mon Sep 17 00:00:00 2001 From: ai-bot Date: Mon, 16 Nov 2026 19:56:20 +0000 Subject: [PATCH] Only refuse when the bank is actually named --- app.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app.py b/app.py index 7757b1e..2ee46cc 100644 --- a/app.py +++ b/app.py @@ -700,14 +700,17 @@ class SkuldHandler(BaseHTTPRequestHandler): raise ApiError( 400, "Forvaltningskostnad rører ingen parti.", "lot_picks" ) - if tx["type"] != "admin_cost" and not _may_name_bank(tx, _bank_market_id(conn)): + bank_id = _bank_market_id(conn) + names_bank = bank_id in (tx["market_id"], tx["to_market_id"]) + if (tx["type"] != "admin_cost" and names_bank + and not _may_name_bank(tx, bank_id)): # The bank is the counterparty of a cost, and a side of a kroner # transfer, and nothing else (docs/spec.md section 3.11). raise ApiError( 400, "Bankkontoen kan berre brukast av forvaltningskostnad og av ei " "overføring i kroner.", - "market_id", + "market_id" if tx["market_id"] == bank_id else "to_market_id", ) previous = None if tx_id is not None: