mirror of
https://github.com/we-promise/sure.git
synced 2026-04-11 00:04:47 +00:00
fix: Move rule application to perform_post_sync method (#705)
* Move rule application to perform_post_sync method Signed-off-by: Alessio Cappa <104093777+alessiocappa@users.noreply.github.com> * fix: Update test --------- Signed-off-by: Alessio Cappa <104093777+alessiocappa@users.noreply.github.com>
This commit is contained in:
@@ -9,11 +9,6 @@ class Family::Syncer
|
||||
# We don't rely on this value to guard the app, but keep it eventually consistent
|
||||
family.sync_trial_status!
|
||||
|
||||
Rails.logger.info("Applying rules for family #{family.id}")
|
||||
family.rules.where(active: true).each do |rule|
|
||||
rule.apply_later
|
||||
end
|
||||
|
||||
# Schedule child syncs
|
||||
child_syncables.each do |syncable|
|
||||
syncable.sync_later(parent_sync: sync, window_start_date: sync.window_start_date, window_end_date: sync.window_end_date)
|
||||
@@ -22,6 +17,11 @@ class Family::Syncer
|
||||
|
||||
def perform_post_sync
|
||||
family.auto_match_transfers!
|
||||
|
||||
Rails.logger.info("Applying rules for family #{family.id}")
|
||||
family.rules.where(active: true).each do |rule|
|
||||
rule.apply_later
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
@@ -62,5 +62,6 @@ class Family::SyncerTest < ActiveSupport::TestCase
|
||||
EnableBankingItem.any_instance.stubs(:sync_later)
|
||||
|
||||
syncer.perform_sync(family_sync)
|
||||
syncer.perform_post_sync
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user