06/03 Optimize code
This commit is contained in:
@@ -7,7 +7,7 @@ from app.models.transaction import Transaction
|
||||
from app.models.category import Category
|
||||
from app.services.fx_service import get_today_rate, get_rate_history, force_refresh
|
||||
from app.services.ai_service import get_latest_daily_insight
|
||||
from app.services.account_service import get_total_assets, get_total_liabilities
|
||||
from app.services.account_service import get_total_assets, get_total_liabilities, recalc_all
|
||||
from datetime import date, datetime, timedelta
|
||||
import calendar
|
||||
|
||||
@@ -62,6 +62,7 @@ def index():
|
||||
net_cash_flow = float(total_income) - float(total_expense)
|
||||
|
||||
# ── Accounts ─────────────────────────────────────
|
||||
recalc_all()
|
||||
accounts = Account.query.filter_by(is_active=True).order_by(Account.name).all()
|
||||
total_assets = get_total_assets()
|
||||
total_liabilities = get_total_liabilities()
|
||||
|
||||
@@ -197,7 +197,17 @@
|
||||
<div style="font-size:11px;color:var(--muted);">{{ acct.account_type | replace('_',' ') | title }}</div>
|
||||
</div>
|
||||
</div>
|
||||
{% if acct.account_type == 'credit_card' %}
|
||||
{% set cc_owed = [0, -acct.balance] | max %}
|
||||
<div class="text-end">
|
||||
<span class="mono {% if cc_owed > 0 %}text-expense{% else %}text-income{% endif %}" style="font-size:13px;font-weight:600;">
|
||||
{% if cc_owed > 0 %}-{% endif %}{{ cc_owed | currency }}
|
||||
</span>
|
||||
<div style="font-size:10px;color:var(--muted);">owed</div>
|
||||
</div>
|
||||
{% else %}
|
||||
<span class="mono {% if acct.balance >= 0 %}text-income{% else %}text-expense{% endif %}" style="font-size:13px;font-weight:600;">{{ acct.balance | currency }}</span>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endfor %}
|
||||
<div class="mt-3 pt-1" style="font-size:12px;color:var(--muted);">
|
||||
|
||||
Reference in New Issue
Block a user