06/05 Optimize app
This commit is contained in:
+16
-1
@@ -1,7 +1,7 @@
|
||||
import os
|
||||
import uuid
|
||||
from flask import (Blueprint, render_template, redirect, url_for, flash,
|
||||
request, current_app, send_from_directory)
|
||||
request, current_app, send_from_directory, jsonify)
|
||||
from flask_login import login_required, current_user
|
||||
from app.utils.audit import audit
|
||||
from flask_wtf import FlaskForm
|
||||
@@ -208,6 +208,21 @@ def recurring():
|
||||
return render_template('settings/recurring.html', rules=rules, upcoming=upcoming)
|
||||
|
||||
|
||||
@settings_bp.route('/recurring/projection')
|
||||
@login_required
|
||||
def recurring_projection():
|
||||
days = request.args.get('days', 30, type=int)
|
||||
if days not in (30, 60, 90):
|
||||
days = 30
|
||||
from app.services.recurring_service import projected_cash_flow
|
||||
data = projected_cash_flow(days)
|
||||
# Serialize events (date objects → string)
|
||||
data['events'] = [
|
||||
{**ev, 'date': ev['date'].strftime('%b %d')} for ev in data['events']
|
||||
]
|
||||
return jsonify(data)
|
||||
|
||||
|
||||
@settings_bp.route('/recurring/new', methods=['GET', 'POST'])
|
||||
@login_required
|
||||
def recurring_new():
|
||||
|
||||
Reference in New Issue
Block a user