Skip to content

Commit

Permalink
Added rounding to Cost and Rate for storage invoice
Browse files Browse the repository at this point in the history
Cost will now be rounded to 2 decimal points
Rate will be rounded to 6 decimal points, since the Openshift Gb/hr rates at the
time of this commit is $0.000009
  • Loading branch information
QuanMPhm committed May 30, 2024
1 parent 4852752 commit 775afd2
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import csv
from decimal import Decimal
from decimal import Decimal, ROUND_HALF_UP
import dataclasses
from datetime import datetime, timedelta
import logging
Expand Down Expand Up @@ -161,7 +161,7 @@ def process_invoice_row(allocation, attrs, su_name, rate):
Invoice_Type_Hours=time,
Invoice_Type=su_name,
Rate=rate,
Cost=time * rate
Cost=(time * rate).quantize(Decimal('.01'), rounding=ROUND_HALF_UP)
)
csv_invoice_writer.writerow(
row.get_values()
Expand Down

0 comments on commit 775afd2

Please sign in to comment.