06/05 Optimize app: report upgrades

This commit is contained in:
2026-06-05 14:22:19 -04:00
parent 2f62417c9f
commit 04acefd9f8
6 changed files with 486 additions and 25 deletions
+12 -8
View File
@@ -5,7 +5,7 @@ from app.models.transaction import Transaction
from app.services.report_service import (
monthly_report, quarterly_report, yearly_report,
net_worth_history, category_trends, tax_year_summary,
take_net_worth_snapshot,
take_net_worth_snapshot, category_mom_comparison,
)
from app.services.export_service import (
transactions_to_csv, transactions_to_excel,
@@ -24,16 +24,16 @@ _CUR_MONTH = date.today().month
@login_required
def index():
today = date.today()
# Default: current month summary
report = monthly_report(today.year, today.month)
report = monthly_report(today.year, today.month)
nw_history = net_worth_history()
cat_trend = category_trends(6)
cat_trend = category_trends(6)
mom_data = category_mom_comparison()
years = list(range(_CUR_YEAR, _CUR_YEAR - 5, -1))
return render_template('reports/index.html',
report=report,
nw_history=nw_history,
cat_trend=cat_trend,
mom_data=mom_data,
years=years,
current_year=_CUR_YEAR,
current_month=_CUR_MONTH,
@@ -46,16 +46,18 @@ def index():
@reports_bp.route('/monthly')
@login_required
def monthly():
year = request.args.get('year', _CUR_YEAR, type=int)
year = request.args.get('year', _CUR_YEAR, type=int)
month = request.args.get('month', _CUR_MONTH, type=int)
report = monthly_report(year, month)
report = monthly_report(year, month)
nw_history = net_worth_history()
cat_trend = category_trends(6)
cat_trend = category_trends(6)
mom_data = category_mom_comparison()
years = list(range(_CUR_YEAR, _CUR_YEAR - 5, -1))
return render_template('reports/index.html',
report=report,
nw_history=nw_history,
cat_trend=cat_trend,
mom_data=mom_data,
years=years,
current_year=_CUR_YEAR,
current_month=_CUR_MONTH,
@@ -78,6 +80,7 @@ def quarterly():
report=report,
nw_history=nw_history,
cat_trend=cat_trend,
mom_data=[],
years=years,
current_year=_CUR_YEAR,
current_month=_CUR_MONTH,
@@ -99,6 +102,7 @@ def yearly():
report=report,
nw_history=nw_history,
cat_trend=cat_trend,
mom_data=[],
years=years,
current_year=_CUR_YEAR,
current_month=_CUR_MONTH,