Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stock Ledger/Stock Balance Failing to Load #842

Open
JustinFowlerArt opened this issue Feb 6, 2024 · 2 comments
Open

Stock Ledger/Stock Balance Failing to Load #842

JustinFowlerArt opened this issue Feb 6, 2024 · 2 comments

Comments

@JustinFowlerArt
Copy link

Can't load stock ledger or stock balance

I recently completed a large (60 hr+) migration from another accounting and inventory software (Craftybase). I have quite a bit of feedback on the migration process and importing that I will provide separately. However, I am currently having an error with the final dataset that is preventing me from validating the accuracy of the inventory since the Stock Ledger and Stock Balance views are not able to load.

I believe that there is a data issue causing the error since it was only erroring when certain days were included in the range with a partial dataset imported (due to batching the imports to improve import speed). However, now that the entire dataset is imported, it is erroring on initial load of those views. I had numerous stock movements or shipments fail while importing, rolled back to a previous db backup, corrected internal data or made edits to the csv files before running the import again. All records wrote successfully on the final attempts.

I am a software developer and interested in contributing to this project, but am not yet familiar with the code base or Electron and curious of any things to check for in the data that might be triggering this error.

Thanks for any help.

Info

Note: This error also occurred in 0.20.1.

Error: Error: invalid input 'Infinity' of type 'string' value: 'Infinity', type: number

Stack:

Error: invalid input 'Infinity' of type 'string' value: 'Infinity', type: number
    at XX (app://assets/index-9daa0156.js:11:34056)
    at ZX (app://assets/index-9daa0156.js:11:33635)
    at kf._f (app://assets/index-9daa0156.js:11:38357)
    at set value [as value] (app://assets/index-9daa0156.js:11:36453)
    at new kf (app://assets/index-9daa0156.js:11:35380)
    at new Dv (app://assets/index-9daa0156.js:11:39496)
    at qX (app://assets/index-9daa0156.js:11:44205)
    at vK.pesa (app://assets/index-9daa0156.js:11:44263)
    at gK (app://assets/index-9daa0156.js:40:5806)
    at mK (app://assets/index-9daa0156.js:40:5610)

Version: 0.21.1
Platform: win32
Path: /report/StockBalance
Language: -
Country: us

@JustinFowlerArt JustinFowlerArt changed the title Stock Ledger/Stock Balance Error Stock Ledger/Stock Balance Failing to Load Feb 6, 2024
@JustinFowlerArt
Copy link
Author

I was able to get going with Electron (much easier than I expected) and found that the issue lies with valuation rates going below 0. I liquidated some of my inventory at the end of 2023, and due to JavaScript being bad with trailing decimals the valuation rates dipped below 0, resulting in my -Infinity. Here is one example prior to the final stock movement that put it negative:

valuationRate:
11.997499999999993
valueChange:
-11.997500000000002

Here is the call stack:
image

@JustinFowlerArt
Copy link
Author

This fix worked for me:

stockQueue.ts line 20

if (Number.isNaN(valuation) || !Number.isFinite(valuation)) {
    return 0;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant