06/01 Optimize codes
This commit is contained in:
@@ -140,6 +140,9 @@ def new():
|
||||
db.session.commit()
|
||||
calc_balance(txn.account_id)
|
||||
flash(f'{"Income" if txn_type == "income" else "Expense"} added.', 'success')
|
||||
if txn_type == 'expense':
|
||||
from app.services.alert_service import check_and_flash_budget_alerts
|
||||
check_and_flash_budget_alerts(flash)
|
||||
return redirect(url_for('transactions.index', tab=txn_type))
|
||||
|
||||
return render_template('transactions/form.html',
|
||||
@@ -174,6 +177,9 @@ def edit(id):
|
||||
calc_balance(old_account_id)
|
||||
calc_balance(txn.account_id)
|
||||
flash('Transaction updated.', 'success')
|
||||
if txn.transaction_type == 'expense':
|
||||
from app.services.alert_service import check_and_flash_budget_alerts
|
||||
check_and_flash_budget_alerts(flash)
|
||||
return redirect(url_for('transactions.index', tab=txn.transaction_type))
|
||||
|
||||
return render_template('transactions/form.html',
|
||||
|
||||
Reference in New Issue
Block a user