#meteograms - Usage Records
1 messages · Page 1 of 1 (latest)
Hello! Usage Records are designed to track the smallest possible unit of what you want to track the usage of, so the quantity is always an integer.
You may need to adjust how you're tracking usage if you find yourself wanting to specify fractional values for the quantity.
What about usage of a liquid that can be dispensed in continuous amounts and not discrete units (e.g. not in bottles)?
I'm just wondering why this is forced on the user. And not a choice.
What's the smallest unit of measurement you use to determine how much is sold? Like ounces?
I'm not sure what you mean by "forced on the user", can you explain?
It is forced on the user that quantity needs to be an integer. Yes I can adjust pricing model so that I set a per ml price rather than a per litre price, even though the per ml price is rather tiny and not "natural". Just wondering why we can't choose to charge for e.g. 1.1 litres at £0.05 per litre, rather than 1100 ml at £0.0005 per ml, if that's how we want to set it up?
We try to avoid floating point numbers in the API to avoid problems with accuracy: https://en.wikipedia.org/wiki/Floating-point_arithmetic#Accuracy_problems
Integers are generally easier to work with, more accurate, and a better choice.
This is also why amount values in the API use the smallest unit of the currency. For example, you specify 1000 for $10.00 USD instead of specifying 10.00.
OK, I'm nearly convinced 🙂