diff options
author | Florian Dold <florian@dold.me> | 2024-11-08 20:22:06 +0100 |
---|---|---|
committer | Florian Dold <florian@dold.me> | 2024-11-08 20:22:06 +0100 |
commit | 748536ad26e295bfe8c9ed2a36cbc18257c1f80a (patch) | |
tree | 1921cea8b41540c2376c28532a386f167bb77192 | |
parent | 7f6a2ac5ab8fcd343a089d2029c0cc337018729e (diff) |
finish other legi measures when inserting new one
-rw-r--r-- | src/exchangedb/exchange_do_trigger_kyc_rule_for_account.sql | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/exchangedb/exchange_do_trigger_kyc_rule_for_account.sql b/src/exchangedb/exchange_do_trigger_kyc_rule_for_account.sql index 707b2c718..4d9fa79b0 100644 --- a/src/exchangedb/exchange_do_trigger_kyc_rule_for_account.sql +++ b/src/exchangedb/exchange_do_trigger_kyc_rule_for_account.sql @@ -90,6 +90,7 @@ THEN out_bad_kyc_auth = FALSE; END IF; END IF; + -- First check if a perfectly equivalent legi measure -- already exists, to avoid creating tons of duplicates. UPDATE legitimization_measures @@ -116,6 +117,13 @@ THEN legitimization_measure_serial_id INTO out_legitimization_measure_serial_id; + + -- mark all other active measures finished! + UPDATE legitimization_measures + SET is_finished=TRUE + WHERE access_token=my_access_token + AND NOT is_finished + AND legitimization_measure_serial_id != out_legitimization_measure_serial_id; END IF; EXECUTE FORMAT ( |