mirror of
https://github.com/we-promise/sure.git
synced 2026-04-19 20:14:08 +00:00
Implement auto family syncs on login (#1021)
This commit is contained in:
@@ -11,6 +11,14 @@ module Account::Syncable
|
||||
syncs.syncing.any?
|
||||
end
|
||||
|
||||
def latest_sync_date
|
||||
syncs.where.not(last_ran_at: nil).pluck(:last_ran_at).max&.to_date
|
||||
end
|
||||
|
||||
def needs_sync?
|
||||
latest_sync_date.nil? || latest_sync_date < Date.current
|
||||
end
|
||||
|
||||
def sync_later(start_date: nil)
|
||||
AccountSyncJob.perform_later(self, start_date: start_date)
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user