Rounding in the price db.

John Ralls jralls at ceridwen.us
Fri Sep 18 09:56:47 EDT 2015


> On Sep 12, 2015, at 12:20 PM, John Ralls <jralls at ceridwen.us> wrote:
> 
> 
>> On Sep 9, 2015, at 6:20 PM, John Ralls <jralls at ceridwen.us> wrote:
>> 
>>> 
>>> On Sep 5, 2015, at 8:44 AM, John Ralls <jralls at ceridwen.us> wrote:
>>> 
>>>> 
>>>> On Sep 4, 2015, at 2:17 AM, Geert Janssens <geert.gnucash at kobaltwit.be> wrote:
>>>> 
>>>> On Tuesday 01 September 2015 15:13:48 John Ralls wrote:
>>>>>> Geert,
>>>>>> 
>>>>>> Thanks for testing. I agree that the check_foo() semantics are
>>>>>> clumsy. I did it that way to avoid negating the return value in the
>>>>>> if conditional, but in retrospect that would be clearer, so I’ll
>>>>>> flip it.
>>>>>> 
>>>>>> Roger that the checks aren’t reliably bidirectional. I’ll dig into
>>>>>> that. I hadn’t yet changed anything with regards to which direction
>>>>>> prices are recorded, at least not on purpose, so I’ll have to track
>>>>>> that down too.
>>>>>> 
>>>>>> I coded up the price-rounding algorithm on the flight back today and
>>>>>> played with it a little. I think it may need some adjustment.
>>>>> I’ve pushed more changes to single-price which I think address Geert’s
>>>>> comments and some tweaks to maximize significant digit preservation
>>>>> while keeping denominators <= 10E6 in most cases. Please test some
>>>>> more!
>>>>> 
>>>>> Regards,
>>>>> John Ralls
>>>> 
>>>> John,
>>>> 
>>>> I pulled your branch again yesterday and ran some tests on it this morning.
>>>> 
>>>> Here is what I did today:
>>>> 
>>>> - removed all prices from the price db.
>>>> - created an invoice in EUR
>>>> - added one entry to this invoice to an account denominated in USD
>>>> - post the invoice => as expected this brings up the transfer dialog to get an exchange rate.
>>>> - as I removed all prices beforehand, there was no suggested price (obviously), so I hit fetch quotes
>>>> => When fetch quotes finished, I still didn't have an exchange rate entered in the dialog.
>>>> - so to continue I entered one myself
>>>> - close transfer dialog and chech the price db via the price editor
>>>> => There are two quotes in there now:
>>>> Security EUR, Currency USD, type user:xfer-dialog
>>>> Security USD, Currency EUR, type Finance::Quote (last)
>>>> 
>>>> The latter seems to have been fetched successfully by the transfer dialog but was never proposed. The former is the price I had to manually enter to continue.
>>>> 
>>>> The exact same thing happens if I now use process payment and for test pay this (Euro denominated) invoice in HKD.
>>>> Transfer dialog won't propose an exchange rate even after hitting the fetch quotes button. Setting one manually will allow me to continue and afterwards there will be two new quotes in the price editor
>>>> Security EUR, Currency HKD, type user:xfer-dialog
>>>> Security HKD, Currency EUR, type Finance::Quote (last)
>>>> 
>>>> Looks like the transfer dialog is not yet fully aware of bidirectional quotes.
>>> 
>>> Not just the Transfer Dialog. Price-quotes.scm doesn’t read the output from gnc-fq-helper quite the way I thought it did. This weekend’s pretty busy but I should be able to fix it Monday along with finishing the source prioritization.
>> 
>> So I’ve got that fixed along with some other issues and the preference of some sources and it’s pushed to my github branch. It’s doing too much rounding somewhere so that our Sao Tomé Dobra test gets rounded to uselessness in one direction, but I think the rest is working. Please test while I wrestle some more with the rounding.
> 
> Rounding is now fixed and pushed.
> 
> There’s one change I’m holding back on: If I make it so that Finance::Quote can’t overwrite a price added in the Price Editor (i.e. one of source user:price-editor) as David Carlson suggested last week, then the “fetch quote” button is broken because price-quotes.scm only knows how to write the prices into the pricedb. This is a per-day effect: A user-created quote from a different day won’t block the F::Q quote, so maybe it’s an acceptable corner case that just needs to be mentioned in the docs and the button’s tooltip. Ideally the button should disable in this situation, but I’m not sure yet whether that’s feasible.
> 
> Comments?
> 
> I should add that I want to merge this ASAP so that it will be available in the nightlies for testing before the next release, which is only two weeks away.

I’ve merged it to maint and after a couple of build hiccups on Win32 it’s in today’s maint nightly:
http://code.gnucash.org/builds/win32/maint/gnucash-2.6.7-2015-09-18-git-766cf48+-setup.exe

Documentation changes are included in the nightly and also in the Documentation nightly at http://gnucash.org/viewdoc.phtml?rev=trunk&lang=C&doc=help. English only until German and Italian translators have a go at it. The new documentation is in the Help, sections 6.2 Transfer Funds Dialog Box and 6.5 Multiple Currency Translations. Feedback appreciated.

Regards,
John Ralls





More information about the gnucash-devel mailing list