Add sync status and errors to account settings page (#1169)

This commit is contained in:
Zach Gollwitzer
2024-09-11 17:24:01 -04:00
committed by GitHub
parent 86741401c3
commit b9341ac302
13 changed files with 124 additions and 38 deletions

View File

@@ -4,4 +4,22 @@ class Institution < ApplicationRecord
has_one_attached :logo
scope :alphabetically, -> { order(name: :asc) }
def sync
accounts.active.each do |account|
if account.needs_sync?
account.sync
end
end
update! last_synced_at: Time.now
end
def syncing?
accounts.active.any? { |account| account.syncing? }
end
def has_issues?
accounts.active.any? { |account| account.has_issues? }
end
end