gnucash master: Multiple changes pushed

Geert Janssens gjanssens at code.gnucash.org
Sun Feb 22 18:41:19 EST 2015


Updated	 via  https://github.com/Gnucash/gnucash/commit/de34215e (commit)
	 via  https://github.com/Gnucash/gnucash/commit/de8d4c80 (commit)
	from  https://github.com/Gnucash/gnucash/commit/118615d7 (commit)



commit de34215ef80c5740baa136f6076f6f16e8860465
Merge: 118615d de8d4c8
Author: Geert Janssens <janssens-geert at telenet.be>
Date:   Mon Feb 23 00:40:57 2015 +0100

    Merge branch 'maint'


commit de8d4c801f623d3b521c4df1d163e939751c12c9
Author: Geert Janssens <janssens-geert at telenet.be>
Date:   Mon Feb 23 00:29:06 2015 +0100

    Add some verbosity to scrubbing
    
    This gives the user a primitive way to track progress for long
    running Check & Repair actions by adding
    --log gnc.engine.scrub=info to the command line options

diff --git a/src/engine/Scrub.c b/src/engine/Scrub.c
index 2c995f4..6b2b4ba 100644
--- a/src/engine/Scrub.c
+++ b/src/engine/Scrub.c
@@ -283,8 +283,9 @@ xaccAccountTreeScrubImbalance (Account *acc)
 void
 xaccAccountScrubImbalance (Account *acc)
 {
-    GList *node;
+    GList *node, *splits;
     const char *str;
+    gint split_count = 0, curr_split_no = 1;
 
     if (!acc) return;
 
@@ -292,14 +293,23 @@ xaccAccountScrubImbalance (Account *acc)
     str = str ? str : "(null)";
     PINFO ("Looking for imbalance in account %s \n", str);
 
-    for (node = xaccAccountGetSplitList(acc); node; node = node->next)
+    splits = xaccAccountGetSplitList(acc);
+    split_count = g_list_length (splits);
+    for (node = splits; node; node = node->next)
     {
         Split *split = node->data;
         Transaction *trans = xaccSplitGetParent(split);
 
+        PINFO("Start processing split %d of %d",
+              curr_split_no, split_count);
+
         xaccTransScrubCurrency(trans);
 
         xaccTransScrubImbalance (trans, gnc_account_get_root (acc), NULL);
+
+        PINFO("Finished processing split %d of %d",
+              curr_split_no, split_count);
+        curr_split_no++;
     }
 }
 
diff --git a/src/engine/ScrubBusiness.c b/src/engine/ScrubBusiness.c
index b99a1ee..9bc113d 100644
--- a/src/engine/ScrubBusiness.c
+++ b/src/engine/ScrubBusiness.c
@@ -41,7 +41,10 @@
 #include "ScrubBusiness.h"
 #include "Transaction.h"
 
-static QofLogModule log_module = GNC_MOD_LOT;
+#undef G_LOG_DOMAIN
+#define G_LOG_DOMAIN "gnc.engine.scrub"
+
+static QofLogModule log_module = G_LOG_DOMAIN;
 
 // A helper function that takes two splits. If the splits are  of opposite sign
 // it reduces the biggest split to have the same value (but with opposite sign)
@@ -465,22 +468,39 @@ void
 gncScrubBusinessAccountLots (Account *acc)
 {
     LotList *lots, *node;
+    gint lot_count = 0;
+    gint curr_lot_no = 1;
+    const gchar *str;
+
     if (!acc) return;
     if (FALSE == xaccAccountIsAPARType (xaccAccountGetType (acc))) return;
 
-    ENTER ("(acc=%s)", xaccAccountGetName(acc));
+    str = xaccAccountGetName(acc);
+    str = str ? str : "(null)";
+
+    ENTER ("(acc=%s)", str);
+    PINFO ("Cleaning up superfluous lot links in account %s \n", str);
     xaccAccountBeginEdit(acc);
 
     lots = xaccAccountGetLotList(acc);
+    lot_count = g_list_length (lots);
     for (node = lots; node; node = node->next)
     {
         GNCLot *lot = node->data;
+
+        PINFO("Start processing lot %d of %d",
+              curr_lot_no, lot_count);
+
         if (lot)
             gncScrubBusinessLot (lot);
+
+        PINFO("Finished processing lot %d of %d",
+              curr_lot_no, lot_count);
+        curr_lot_no++;
     }
     g_list_free(lots);
     xaccAccountCommitEdit(acc);
-    LEAVE ("(acc=%s)", xaccAccountGetName(acc));
+    LEAVE ("(acc=%s)", str);
 }
 
 /* ============================================================== */
diff --git a/src/gnome/gnc-plugin-page-register.c b/src/gnome/gnc-plugin-page-register.c
index 3acfd35..269cb90 100644
--- a/src/gnome/gnc-plugin-page-register.c
+++ b/src/gnome/gnc-plugin-page-register.c
@@ -3736,10 +3736,8 @@ gnc_plugin_page_register_cmd_scrub_all (GtkAction *action,
     GncPluginPageRegisterPrivate *priv;
     Query *query;
     Account *root;
-    Transaction *trans;
-    GNCLot *lot;
-    Split *split;
-    GList *node;
+    GList *node, *splits;
+    gint split_count = 0, curr_split_no = 1;
 
     g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(plugin_page));
 
@@ -3756,10 +3754,17 @@ gnc_plugin_page_register_cmd_scrub_all (GtkAction *action,
     gnc_suspend_gui_refresh();
     root = gnc_get_current_root_account();
 
-    for (node = qof_query_run(query); node; node = node->next)
+    splits = qof_query_run(query);
+    split_count = g_list_length (splits);
+    for (node = splits; node; node = node->next)
     {
-        split = node->data;
-        trans = xaccSplitGetParent(split);
+        GNCLot *lot;
+        Split *split = node->data;
+        Transaction *trans = xaccSplitGetParent(split);
+
+
+        PINFO("Start processing split %d of %d",
+              curr_split_no, split_count);
 
         xaccTransScrubOrphans(trans);
         xaccTransScrubImbalance(trans, root, NULL);
@@ -3767,6 +3772,10 @@ gnc_plugin_page_register_cmd_scrub_all (GtkAction *action,
         lot = xaccSplitGetLot (split);
         if (lot && xaccAccountIsAPARType (xaccAccountGetType (xaccSplitGetAccount (split))))
             gncScrubBusinessLot (lot);
+
+        PINFO("Finished processing split %d of %d",
+              curr_split_no, split_count);
+        curr_split_no++;
     }
 
     gnc_resume_gui_refresh();



Summary of changes:
 src/engine/Scrub.c                   | 14 ++++++++++++--
 src/engine/ScrubBusiness.c           | 26 +++++++++++++++++++++++---
 src/gnome/gnc-plugin-page-register.c | 23 ++++++++++++++++-------
 3 files changed, 51 insertions(+), 12 deletions(-)



More information about the gnucash-changes mailing list