[GNC-dev] Two steps forward (Maybe three back)

Stephen M. Butler kg7je at arrl.net
Mon Jan 21 01:48:40 EST 2019


On 1/20/19 8:07 PM, Christopher Lam wrote:
> There's no reason why the dates can't be changed.
>
> The reason dates straggling 1.1.1970 was chosen was because 1.1.1970
> corresponds to time 0 in time64, and I felt that having a few negative
> time64 numbers would be interesting to test sorting.
>
> However this is a weird weirdness -- the test output shows that the
> transactions were sorted correctly - 31/12/69, 31/12/69, 01/01/70,
> 02/01/70, 02/10/70 (in d/m/y); it's just the display that is incorrect.
>
> Moreover the display has to go through qof_print_date which takes a
> time64 and returns a string.
>
> I'd be keen to know Stephen's build and try debug this.
>
> Stephen can you modify transaction.scm as follows and let us know the
> test output? (Beware the parentheses!)
>
> modified   gnucash/report/standard-reports/transaction.scm
> @@ -1119,7 +1119,8 @@ be excluded from periodic reporting.")
>                                   (if transaction-row?
> (gnc:make-html-table-cell/markup
>                                        "date-cell"
> -                                      (qof-print-date
> (xaccTransGetDate (xaccSplitGetParent split))))
> +                                      (let ((date (xaccTransGetDate
> (xaccSplitGetParent split))))
> +                                        (gnc:pk 'date date
> 'qof-print-date (qof-print-date date))))
>                                       ""))))
>
>                 (add-if (column-uses? 'reconciled-date)

My apologies for the long delay in getting back to you.  The wife
indicated that we'd better spend some time in the hot tub watching the
lunar eclipse.  So I leaned back and gazed up into the dark gray
featureless sky at where the moon should be.  Nadda.  Good soak though
and the spine is thankful.

The other problem is that my 1119 doesn't match up.  At first when I
went back to the maint branch the changes stayed in the directory.  I
had to be sure I had the real file from git.  So, here is the code block
with line 1119 marked.


              (add-if (column-uses? 'num)

                       (vector (if (and BOOK-SPLIT-ACTION
                                        (opt-val gnc:pagename-display
(N_ "Trans Number")))
                                   (_ "Num/T-Num")
                                   (_ "Num"))
                               (lambda (split transaction-row?)
                                 (let* ((trans (xaccSplitGetParent split))
                                        (num (gnc-get-num-action trans
split))
                                        (t-num (if (and BOOK-SPLIT-ACTION
                                                        (opt-val
gnc:pagename-display (N_ "Trans Number")))
                                                   (gnc-get-num-action
trans #f)
                                                   ""))
                                        (num-string (if (string-null? t-num)
                                                        num
                                                        (string-append
num "/" t-num))))
                                   (if transaction-row?
                                       (gnc:make-html-table-cell/markup
"text-cell" num-string)
                                       "")))))
1119
               (add-if (column-uses? 'description)
                       (vector (_ "Description")
                               (lambda (split transaction-row?)
                                 (define trans (xaccSplitGetParent split))
                                 (if transaction-row?
                                     (gnc:make-html-table-cell/markup
                                      "text-cell"
                                      (xaccTransGetDescription trans))
                                     ""))))


I think the line you want changed is above at 1083-1090:

1083           (add-if (column-uses? 'date)
                       (vector (_ "Date")
                               (lambda (split transaction-row?)
                                 (if transaction-row?
                                     (gnc:make-html-table-cell/markup
                                      "date-cell"
                                      (qof-print-date (xaccTransGetDate
(xaccSplitGetParent split))))
1090                              ""))))

Changed:

              (add-if (column-uses? 'date)
                       (vector (_ "Date")
                               (lambda (split transaction-row?)
                                 (if transaction-row?
                                     (gnc:make-html-table-cell/markup
                                      "date-cell"
                                      (let ((date (xaccTransGetDate
(xaccSplitGetParent split))))
                                        (gnc:pk 'date date
'qof-print-date (qof-print-date date))))
                                     ""))))
Copy paste worked to keep from having to count the parenthesis!

108/115 Test #108: test-charts ..................................  
Passed    1.91 sec
        Start 109: test-transaction
109/115 Test #109: test-transaction
.............................***Failed    3.88 sec
        Start 110: test-balsheet-pnl
110/115 Test #110: test-balsheet-pnl ............................  
Passed    2.57 sec
        Start 111: test-income-gst

......

d0.0005 t1.869: ('date 2717940 'qof-print-date 02/01/70)
d0.0005 t1.870: ('date 3495540 'qof-print-date 02/10/70)
[fail] line:678, test: dates are sorted
transaction.scm/sorting options
 -> expected: ("12/31/69" "12/31/69" "01/01/70" "02/01/70" "02/10/70")
 -> obtained: ("12/31/70" "12/31/70" "01/01/70" "02/01/70" "02/10/70")
d0.0163 t1.886: ('date 39540 'qof-print-date 01/01/70)

.......

109/115 Testing: test-transaction
109/115 Test: test-transaction
Command: "/usr/bin/cmake" "-E" "env" "/usr/bin/guile" "--debug" "-l"
"/home/steve/Projects/GnuCash/gnucash/gnucash/report/standard-reports/test/test-transaction.scm"
"-c" "(exit (run-test))"
Directory:
/home/steve/Projects/GnuCash/gnucash/.build/gnucash/report/standard-reports/test
"test-transaction" start time: Jan 20 22:33 PST
Output:
----------------------------------------------------------
* 22:33:20  WARN <gnc.gui> [gnc_configure_reverse_balance()] no reversed
account preference set, using none
[pass] line:130, test: null-test
d0.7194 t0.719: ('date 1546513140 'qof-print-date 01/03/19)

I did a tar -czf testfiles.ztar *.txt *.log on the files in
./.build/Testing/Temporary and attached

Hope I made the desired change.

--Steve


-- 
Stephen M Butler, PMP, PSM
Stephen.M.Butler51 at gmail.com
kg7je at arrl.net
253-350-0166
-------------------------------------------
GnuPG Fingerprint:  8A25 9726 D439 758D D846 E5D4 282A 5477 0385 81D8

-------------- next part --------------
A non-text attachment was scrubbed...
Name: testfiles.ztar
Type: application/octet-stream
Size: 25697 bytes
Desc: not available
URL: <http://lists.gnucash.org/pipermail/gnucash-devel/attachments/20190120/b2fdc073/attachment.obj>


More information about the gnucash-devel mailing list