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
Replace normalize with integer wrapper for quantity field #1446
Conversation
There are definitely cases where the BOM quantity can be a non integer number - e.g. you might need Maybe we can replace normalize here with a float? |
Looks like float would work for YAML: >>> import yaml
>>> dec = 1.23456
>>> print(dec)
1.23456
>>> type(dec)
<class 'float'>
>>> yaml.safe_dump(dec)
'1.23456\n...\n'
>>> dec = 1.2345600000
>>> yaml.safe_dump(dec)
'1.23456\n...\n' But I'm not sure all the other formats would remove the trailing zeros... |
Can we check the output format and choose 'float' if it is a yaml file? |
I don't really find a good way to check the export format and pass it to the |
Ok, what does the output look like for a .csv file? Does it suppress the trailing zeros correctly? |
@SchrodingersGat I tested all formats with So if we are okay that quantity of |
Seems like a reasonable compromise. |
Thanks for the fix :) |
No problem, thanks for merging 👍 |
In a attempt to fix #1443
I don't see when can the BOM Item quantity be a decimal number and it was causing the error in the BOM export because the PyYAML library doesn't have a
Decimal
object representation.