Sort expenses by date desc, and then by name and total

This make more sense, as is the same order user by invoices, and the
most recent expense is at the top.

Closes #79
This commit is contained in:
jordi fita mas 2023-10-02 11:04:35 +02:00
parent 52256c3cb9
commit 60ec335769
1 changed files with 2 additions and 2 deletions

View File

@ -55,7 +55,7 @@ func mustCollectExpenseEntries(ctx context.Context, conn *Conn, locale *Locale,
select expense.slug
, invoice_date
, invoice_number
, to_price(expense.amount + coalesce(sum(tax.amount)::integer, 0), decimal_digits)
, to_price(expense.amount + coalesce(sum(tax.amount)::integer, 0), decimal_digits) as total
, contact.name
, coalesce(attachment.original_filename, '')
, expense.tags
@ -78,7 +78,7 @@ func mustCollectExpenseEntries(ctx context.Context, conn *Conn, locale *Locale,
, expense.tags
, expense.expense_status
, esi18n.name
order by invoice_date
order by invoice_date desc, contact.name, total desc
`, where), args...)
defer rows.Close()