mirror of
https://github.com/we-promise/sure.git
synced 2026-05-12 15:15:01 +00:00
feat(enable-banking): safe pending transaction merge with sync re-import prevention (#1709)
* feat(enable-banking): safe pending transaction merge with sync re-import prevention * preserve all merged pending IDs across syncs * fix(enable-banking): harden merge locking, safe logging, and non-blocking index * fix(enable-banking): use safe external ID in invalid currency log * refactor(models): centralize pending transaction SQL logic Move the SQL fragment used to identify pending transactions from the `Entry` model to a constant in the `Transaction` model. This improves maintainability and ensures that the logic for determining if a transaction is pending is defined in a single location. * fix(enable-banking): drop dead manual_merge index, use lateral join for excluded IDs * No net schema changes --------- Co-authored-by: Juan José Mata <jjmata@jjmata.com>
This commit is contained in:
@@ -52,6 +52,10 @@ class PendingDuplicateMergesController < ApplicationController
|
||||
else
|
||||
redirect_back_or_to transactions_path, alert: "Could not merge transactions"
|
||||
end
|
||||
rescue ActiveRecord::RecordInvalid, ActiveRecord::RecordNotDestroyed,
|
||||
ActiveRecord::Deadlocked, ActiveRecord::LockWaitTimeout => e
|
||||
Rails.logger.error("Failed to manually merge pending transaction: #{e.message}")
|
||||
redirect_back_or_to transactions_path, alert: t("transactions.merge_duplicate.failure")
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
Reference in New Issue
Block a user