mirror of
https://github.com/we-promise/sure.git
synced 2026-04-21 13:04:18 +00:00
Harden SimpleFIN sync: protect user data, fix stuck syncs, optimize API calls (#671)
* Implement entry protection flags for sync overwrites - Added `user_modified` and `import_locked` flags to `entries` table to prevent provider sync from overwriting user-edited and imported data. - Introduced backfill migration to mark existing entries based on conditions. - Enhanced sync and processing logic to respect protection flags, track skipped entries, and log detailed stats. - Updated UI to display skipped/protected entries and reasons in sync summaries. * Localize error details summary text and adjust `sync_account_later` method placement * Restored schema.rb --------- Co-authored-by: luckyPipewrench <luckypipewrench@proton.me>
This commit is contained in:
@@ -48,10 +48,12 @@ class TransactionImport < Import
|
||||
duplicate_entry.transaction.tags = tags if tags.any?
|
||||
duplicate_entry.notes = row.notes if row.notes.present?
|
||||
duplicate_entry.import = self
|
||||
duplicate_entry.import_locked = true # Protect from provider sync overwrites
|
||||
updated_entries << duplicate_entry
|
||||
claimed_entry_ids.add(duplicate_entry.id)
|
||||
else
|
||||
# Create new transaction (no duplicate found)
|
||||
# Mark as import_locked to protect from provider sync overwrites
|
||||
new_transactions << Transaction.new(
|
||||
category: category,
|
||||
tags: tags,
|
||||
@@ -62,7 +64,8 @@ class TransactionImport < Import
|
||||
name: row.name,
|
||||
currency: effective_currency,
|
||||
notes: row.notes,
|
||||
import: self
|
||||
import: self,
|
||||
import_locked: true
|
||||
)
|
||||
)
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user