andreasgerstmayr / fava-dashboards

Custom Dashboards for Beancount in Fava
MIT License
143 stars 17 forks source link

compatiable for NaN data value #49

Closed RukawaKaede closed 3 weeks ago

RukawaKaede commented 1 month 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 1 month 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 1 month 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 3 weeks ago

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