Closed naved001 closed 6 months ago
Edit: I added this example as a test to the code.
I generated the report for March again to see how much difference this would make. I noticed that for a couple of projects the cost were now more by 1 cent which was due to a combination of floating point math being imprecise followed by python's rounding.
Here's that scenario
>>> rate = 0.013
>>> hours = 4075
>>> rate*hours
52.974999999999994 # result is less than the actual value of 52.975
>>> round(rate*hours,2)
52.97
Using decimals
>>> from decimal import Decimal, ROUND_HALF_UP
>>> rate = Decimal("0.013")
>>> hours = 4075
>>> rate*hours
Decimal('52.975')
>>> (rate*hours).quantize(Decimal("0.01"), rounding=ROUND_HALF_UP)
Decimal('52.98')
The tests for the usage report by each pod was updated so it matches the precision.