gnucash stable: [gnc-tree-view-account.c] logical bugfix sort by last reconcile date

Christopher Lam clam at code.gnucash.org
Tue Jan 13 05:38:28 EST 2026


Updated	 via  https://github.com/Gnucash/gnucash/commit/2f94d161 (commit)
	from  https://github.com/Gnucash/gnucash/commit/1d9b80f7 (commit)



commit 2f94d1611b61b78654807d898db03461bec42894
Author: Christopher Lam <christopher.lck at gmail.com>
Date:   Tue Jan 13 09:29:55 2026 +0800

    [gnc-tree-view-account.c] logical bugfix sort by last reconcile date
    
    if acct isn't reconciled, its date for comparison is taken to be epoch
    zero. fix the reconciliation logic; unreconciled < reconciled.

diff --git a/gnucash/gnome-utils/gnc-tree-view-account.c b/gnucash/gnome-utils/gnc-tree-view-account.c
index a58b6cff03..d3cfe1e8f3 100644
--- a/gnucash/gnome-utils/gnc-tree-view-account.c
+++ b/gnucash/gnome-utils/gnc-tree-view-account.c
@@ -292,16 +292,17 @@ sort_by_last_reconcile_date (GtkTreeModel *f_model,
                              gpointer user_data)
 {
     const Account *account1, *account2;
-    time64 account1_date, account2_date;
+    time64 account1_date = 0, account2_date = 0;
 
     sort_cb_setup (f_model, f_iter1, f_iter2, &account1, &account2);
 
-    if (!xaccAccountGetReconcileLastDate (account1, &account1_date))
-        account1_date = 0;
-
-    if (!xaccAccountGetReconcileLastDate (account2, &account2_date))
-        account2_date = 0;
+    gboolean rec1 = xaccAccountGetReconcileLastDate (account1, &account1_date);
+    gboolean rec2 = xaccAccountGetReconcileLastDate (account2, &account2_date);
 
+    if (!rec1)
+        return rec2 ? -1 : xaccAccountOrder (account1, account2);
+    if (!rec2)
+        return 1;
     if (account1_date < account2_date)
         return -1;
     else if (account1_date > account2_date)



Summary of changes:
 gnucash/gnome-utils/gnc-tree-view-account.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)



More information about the gnucash-changes mailing list