gnucash stable: Fix test breakage from account list reversal.

John Ralls jralls at code.gnucash.org
Sat Apr 1 21:14:44 EDT 2023


Updated	 via  https://github.com/Gnucash/gnucash/commit/d8a3e831 (commit)
	from  https://github.com/Gnucash/gnucash/commit/634b9f87 (commit)



commit d8a3e83189aa426ead1fa0395bf917670e036ba6
Author: John Ralls <jralls at ceridwen.us>
Date:   Sat Apr 1 18:14:31 2023 -0700

    Fix test breakage from account list reversal.

diff --git a/bindings/guile/gnc-optiondb.i b/bindings/guile/gnc-optiondb.i
index ee443782ff..2730295d48 100644
--- a/bindings/guile/gnc-optiondb.i
+++ b/bindings/guile/gnc-optiondb.i
@@ -470,6 +470,7 @@ scm_to_value<GncOptionAccountList>(SCM new_value)
     retval.reserve(scm_to_size_t(scm_length(new_value)));
 
     auto next{new_value};
+    auto from_report{true};
     while (!scm_is_null(next) && scm_car(next))
     {
 /* If the incoming scheme is from a report then it will contain an Account*, if
@@ -478,6 +479,7 @@ scm_to_value<GncOptionAccountList>(SCM new_value)
         if (scm_is_string(scm_car(next)))
         {
             auto guid_str{scm_to_utf8_string(scm_car(next))};
+            from_report = false;
             GncGUID guid;
             string_to_guid(guid_str, &guid);
             retval.push_back(guid);
@@ -495,7 +497,8 @@ scm_to_value<GncOptionAccountList>(SCM new_value)
         next = scm_cdr(next);
     }
 
-    std::reverse(retval.begin(), retval.end());
+    if (!from_report)
+        std::reverse(retval.begin(), retval.end());
     return retval;
 }
 



Summary of changes:
 bindings/guile/gnc-optiondb.i | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)



More information about the gnucash-changes mailing list