hledger icon indicating copy to clipboard operation
hledger copied to clipboard

a confusing interaction of D, P and the no-symbol commodity

Open simonmichael opened this issue 7 years ago • 1 comments

This is an unusual situation, but is there something better we should do here ?

D USD 1.00
P 2018/1/1 USD  2

2018/1/1
  (a)  1
$ hledger print -V
2018/01/01
    (a)        USD 2.00

Explanation:

  • D assigns the USD commodity to the no-symbol a amount, making it USD 1
  • P declares that 1 USD is worth two of the no-symbol commodity
  • -V converts the USD 1 to no-symbol 2
  • D assigns the USD commodity (again?), making it USD 2. Which is incorrect.

It seems like D is being applied a second time.

simonmichael avatar Jun 20 '18 20:06 simonmichael

Current hledger behaves differently, valuation has no effect:

$ hledger print 
2018-01-01
    (a)        USD 1.00

$ hledger print -V
2018-01-01
    (a)        USD 1.00

$ hledger print -X ''
2018-01-01
    (a)        USD 1.00

I sort of expected to see

    (a)        2

(Apply USD as default commodity to get 1 USD; convert to value in default valuation commodity ("") to get 2.)

simonmichael avatar Jun 22 '23 02:06 simonmichael