mirror of
https://github.com/maybe-finance/maybe.git
synced 2025-07-19 13:19:39 +02:00
* Placeholder logic for missing prices * Generate holdings properly for "offline" securities * Separate forward and reverse calculators for holdings and balances * Remove unnecessary currency conversion during sync * Clearer sync process * Move price caching logic to dedicated model * Base holding calculator * Base calculator for balances * Finish balance calculators * Better naming * Logs cleanup * Remove stale data type * Remove stale test * Fix price lookup logic for holdings sync * Fix Plaid item sync regression * Remove temp logging * Calculate cash and holdings series * Add holdings, cash, and balance series dropdown for investments
45 lines
811 B
Ruby
45 lines
811 B
Ruby
class AccountsController < ApplicationController
|
|
before_action :set_account, only: %i[sync chart sparkline]
|
|
include Periodable
|
|
|
|
def index
|
|
@manual_accounts = family.accounts.manual.alphabetically
|
|
@plaid_items = family.plaid_items.ordered
|
|
|
|
render layout: "settings"
|
|
end
|
|
|
|
def sync
|
|
unless @account.syncing?
|
|
@account.sync_later
|
|
end
|
|
|
|
redirect_to account_path(@account)
|
|
end
|
|
|
|
def chart
|
|
@chart_view = params[:chart_view] || "balance"
|
|
render layout: "application"
|
|
end
|
|
|
|
def sparkline
|
|
render layout: false
|
|
end
|
|
|
|
def sync_all
|
|
unless family.syncing?
|
|
family.sync_later
|
|
end
|
|
|
|
redirect_to accounts_path
|
|
end
|
|
|
|
private
|
|
def family
|
|
Current.family
|
|
end
|
|
|
|
def set_account
|
|
@account = family.accounts.find(params[:id])
|
|
end
|
|
end
|