ananthakumaran / paisa

Paisa – Personal Finance Manager. https://paisa.fyi demo: https://demo.paisa.fyi
https://paisa.fyi
GNU Affero General Public License v3.0
2.4k stars 124 forks source link

Prices page in ledger is not loading. #52

Closed avinashkanaujiya closed 11 months ago

avinashkanaujiya commented 11 months ago

Maybe I did wrong configuration, can anyone guide me? image There is no error in terminal. The console has below error

21.d8eebcce.js:1 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'commodity_name')
    at Array.yt (21.d8eebcce.js:1:690)
    at ht (scheduler.b2e36843.js:1:802)
    at z (Toggleable.7c088a46.js:1:553)
    at Ot (index.4c91fe54.js:4:2967)
    at new E (Toggleable.7c088a46.js:1:1170)
    at ot (21.d8eebcce.js:1:4188)
    at Object.p (21.d8eebcce.js:1:5943)
    at ct (scheduler.b2e36843.js:1:8618)
    at rt (scheduler.b2e36843.js:1:8271)
ananthakumaran commented 11 months ago

Can you open developer tools > Network tab and view the response of /api/price call? One of the commodities would have an empty array, the problem is due to that. Still trying to figure out how it could go into that state.

avinashkanaujiya commented 11 months ago

In the response, I can see that AAPL has the empty array.

ananthakumaran commented 11 months ago

Do you have that commodity? or it's just in your commodity config?

avinashkanaujiya commented 11 months ago

Oh, it wasn't in my commodities config, but it is in my portfolio, now I think all the other are resolved. I think somehow, it should be managed in the code, that if commodities are not added, then it shouldn't try to look for it.

ananthakumaran commented 11 months ago

Can you share your transaction with AAPL entry? I will fix the issue, just want to confirm I am fixing the same issue.

avinashkanaujiya commented 11 months ago

Here is my apple transaction.

2023-05-08 Opening Balance US Stocks
    Assets:Equity:Indmoney                0.69057594 AAPL @ 173.768 USD
    Equity

Also just to summarize, as I wasn't clear in my last comment. I forgot to add AAPL stock to my commodities config, after which everything related to prices of commodities stopped working. Once I added AAPL stock to config, everything is working just fine.

ananthakumaran commented 11 months ago

is USD your default currency? if not Paisa will still not know how to convert USD to INR. You can instead specify the price in INR (if you don't know the price, just put a dummy value, once you fetch the price from the provider, the doctor page will warn about price mismatch)

I have pushed a fix for the error and the doctor page will also start to warn if it can't convert from commodity to default currency