From 60ec33576988986cd9672b31f4f3358d58a76483 Mon Sep 17 00:00:00 2001 From: jordi fita mas Date: Mon, 2 Oct 2023 11:04:35 +0200 Subject: [PATCH] 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 --- pkg/expenses.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/expenses.go b/pkg/expenses.go index 27e0022..0016bc6 100644 --- a/pkg/expenses.go +++ b/pkg/expenses.go @@ -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()