why not account-get-transactions and simpler cash-flow test for already seen split?

Larry Evans cppljevans at cox-internet.com
Thu Jul 6 23:13:02 EDT 2006


The code in both:

http://svn.gnucash.org/trac/browser/gnucash/trunk/src/report/standard-reports/advanced-portfolio.scm

and in:

http://svn.gnucash.org/trac/browser/gnucash/trunk/src/report/standard-reports/cash-flow.scm

both seem to have similar code for processing a set of accounts and 
their transactions.  In pseudo-code, this idiom is:

   for-each account in set-of-accounts
     for-each account-split in account
       transaction = parent-of account-split
       for-each transaction-split in transaction
         if(transaction-split != account-split)
           do-something with transaction-split

Now the function and variable names in actual code and pseudo code are:

   pseudo            actual
   ------            ------
   parent-of         gnc:split-get-parent
   account-split     split
   transaction-split s
   transaction       parent

and the if test in actual code is:

   advanced-portfolio:

     same-split? s split

   cash-flow:

     split-in-list? s seen-split-list

     where: seen-split-list is a list of splits which is appended to
       for each time the test fails.

Could the advanced-portfolio test couldn't be used in place of the
cash-flow test, and thereby, save some time?

Also, could someone explain why there couldn't just be a function:

   gnc:account-get-transactions

which could be used to get the list of transaction in an account instead
of getting the splits with gnc:account-get-split-list?  It seems from
looking at the code that the parent is actually a transaction because
there's this code:

   gnc:transaction-get-splits parent



TIA.




More information about the gnucash-user mailing list