andreasgerstmayr / fava-dashboards

Custom Dashboards for Beancount in Fava
MIT License
176 stars 21 forks source link

compatiable for NaN data value #49

Closed RukawaKaede closed 5 months ago

RukawaKaede commented 6 months ago

Hi! I encountered a NaN bql result for an account. This lead to some issues in several dashboards. So I added a isNaN judgement in the code and fixed it.

andreasgerstmayr commented 6 months ago

I think the valueFn callback should return a valid number in the first place, instead of handling this in the buildAccountTree() function.

Can you provide a minimal reproducible example to trigger this issue? Or describe under which circumstances valueFn returns NaN?

RukawaKaede commented 5 months ago

Sure thing! For example: ` 1980-05-12 open Expenses:Test

2020-01-01 open Liabilities:Test USD account: "test"

2020-01-02 * "credit card expense" Liabilities:Test -9.99 USD Expenses:Test 9.99 USD

2020-01-03 * "dispute credit card expense" Liabilities:Test 9.99 USD Expenses:Test -9.99 USD

`

andreasgerstmayr commented 5 months ago

Thanks for the example! I've fixed the valueFns in the example dashboard.