mirror of
https://github.com/maybe-finance/maybe.git
synced 2025-07-25 08:09:38 +02:00
Implement auto family syncs on login (#1021)
This commit is contained in:
parent
c8590d53ba
commit
ef4be7948a
11 changed files with 59 additions and 9 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue