Fully reverse order of sorting of transactions, etc.

Order transactions on the same day in reverse order of ID
This commit is contained in:
RunasSudo 2024-04-04 01:53:46 +11:00
parent bf34d6c3bf
commit c56cac115f
Signed by: RunasSudo
GPG Key ID: 7234E476BF21C61A
4 changed files with 6 additions and 6 deletions

View File

@ -29,7 +29,7 @@ from math import copysign
@app.route('/tax/cgt-adjustments')
def cgt_adjustments():
adjustments = db.select(CGTCostAdjustment).order_by(CGTCostAdjustment.dt.desc(), CGTCostAdjustment.account)
adjustments = db.select(CGTCostAdjustment).order_by(CGTCostAdjustment.dt.desc(), CGTCostAdjustment.account, CGTCostAdjustment.id.desc())
if 'account' in request.args:
adjustments = adjustments.where(CGTCostAdjustment.account == request.args['account'])
if 'quantity' in request.args:

View File

@ -27,7 +27,7 @@ from datetime import datetime
@app.route('/journal')
def journal():
transactions = db.session.scalars(db.select(Transaction).options(db.selectinload(Transaction.postings)).order_by(Transaction.dt.desc())).all()
transactions = db.session.scalars(db.select(Transaction).options(db.selectinload(Transaction.postings)).order_by(Transaction.dt.desc(), Transaction.id.desc())).all()
return render_template(
'journal/journal.html',
@ -125,7 +125,7 @@ def journal_edit_transaction():
@app.route('/balance-assertions')
def balance_assertions():
assertions = db.session.scalars(db.select(BalanceAssertion).order_by(BalanceAssertion.dt.desc())).all()
assertions = db.session.scalars(db.select(BalanceAssertion).order_by(BalanceAssertion.dt.desc(), BalanceAssertion.id.desc())).all()
# Check assertion status
transactions = all_transactions()

View File

@ -29,7 +29,7 @@ def statement_lines():
# JOIN all associated postings (called in is_complex/charge_account)
statement_lines = db.select(StatementLine).options(
db.joinedload(StatementLine.reconciliation).joinedload(StatementLineReconciliation.posting).joinedload(Posting.transaction).joinedload(Transaction.postings)
).order_by(StatementLine.dt.desc())
).order_by(StatementLine.dt.desc(), StatementLine.id.desc())
if 'account' in request.args:
statement_lines = statement_lines.where(StatementLine.source_account == request.args['account'])

View File

@ -87,14 +87,14 @@ def account_transactions():
'transactions_commodity_detail.html',
account=request.args['account'],
running_total=Balance(),
transactions=sorted(transactions, key=lambda t: t.dt, reverse=True)
transactions=reversed(sorted(transactions, key=lambda t: t.dt))
)
else:
return render_template(
'transactions.html',
account=request.args['account'],
running_total=Amount(0, '$'),
transactions=sorted(transactions, key=lambda t: t.dt, reverse=True)
transactions=reversed(sorted(transactions, key=lambda t: t.dt))
)
@app.route('/balance-sheet')