mirror of
https://github.com/maybe-finance/maybe.git
synced 2025-08-09 15:35:22 +02:00
30 day syncs by default
This commit is contained in:
parent
6a1d625a4f
commit
efea7bfc01
4 changed files with 23 additions and 25 deletions
|
@ -10,7 +10,7 @@ module Syncable
|
|||
end
|
||||
|
||||
def sync_later(parent_sync: nil, window_start_date: nil, window_end_date: nil)
|
||||
new_sync = syncs.create!(parent: parent_sync, window_start_date: window_start_date, window_end_date: window_end_date)
|
||||
new_sync = syncs.create_with_defaults!(parent: parent_sync)
|
||||
SyncJob.perform_later(new_sync)
|
||||
end
|
||||
|
||||
|
|
|
@ -31,7 +31,14 @@ class Sync < ApplicationRecord
|
|||
end
|
||||
end
|
||||
|
||||
def perform(window_start_date: nil, window_end_date: nil)
|
||||
class << self
|
||||
# By default, we sync the "visible" window of data (user sees 30 day graphs by default)
|
||||
def create_with_defaults!(parent: nil)
|
||||
create!(parent: parent, window_start_date: 30.days.ago.to_date)
|
||||
end
|
||||
end
|
||||
|
||||
def perform
|
||||
start!
|
||||
|
||||
begin
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
<h1 class="text-xl"><%= t(".accounts") %></h1>
|
||||
<div class="flex items-center gap-5">
|
||||
<div class="flex items-center gap-2">
|
||||
<% if Rails.env.development? %>
|
||||
<%= render ButtonComponent.new(
|
||||
text: "Sync all",
|
||||
href: sync_all_accounts_path,
|
||||
|
@ -11,6 +12,7 @@
|
|||
icon: "refresh-cw",
|
||||
class: ""
|
||||
) %>
|
||||
<% end %>
|
||||
|
||||
<%= render LinkComponent.new(
|
||||
text: "New account",
|
||||
|
|
|
@ -20,23 +20,12 @@
|
|||
<% end %>
|
||||
|
||||
<div class="flex items-center gap-1 ml-auto">
|
||||
<% if account.plaid_account_id.present? %>
|
||||
<% if Rails.env.development? %>
|
||||
<%= icon(
|
||||
"refresh-cw",
|
||||
as_button: true,
|
||||
size: "sm",
|
||||
href: sync_plaid_item_path(account.plaid_account.plaid_item),
|
||||
disabled: account.syncing?,
|
||||
frame: :_top
|
||||
) %>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<%= icon(
|
||||
"refresh-cw",
|
||||
as_button: true,
|
||||
size: "sm",
|
||||
href: sync_account_path(account),
|
||||
href: account.linked? ? sync_plaid_item_path(account.plaid_account.plaid_item) : sync_account_path(account),
|
||||
disabled: account.syncing?,
|
||||
frame: :_top
|
||||
) %>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue