fix time constaint calculation
parent
3c95085bf8
commit
a770bf85d5
@ -0,0 +1,33 @@
|
||||
from decimal import Decimal, getcontext
|
||||
|
||||
def get_material_cost(scope, total_equipment):
|
||||
# Set precision to 28 digits (maximum precision for Decimal)
|
||||
getcontext().prec = 28
|
||||
|
||||
if not total_equipment: # Guard against division by zero
|
||||
return float(0)
|
||||
|
||||
if scope == 'B':
|
||||
result = Decimal('365539731101') / Decimal(str(total_equipment))
|
||||
return float(result)
|
||||
else:
|
||||
result = Decimal('8565468127') / Decimal(str(total_equipment))
|
||||
return float(result)
|
||||
|
||||
return float(0)
|
||||
|
||||
def get_service_cost(scope, total_equipment):
|
||||
# Set precision to 28 digits (maximum precision for Decimal)
|
||||
getcontext().prec = 28
|
||||
|
||||
if not total_equipment: # Guard against division by zero
|
||||
return float(0)
|
||||
|
||||
if scope == 'B':
|
||||
result = Decimal('36405830225') / Decimal(str(total_equipment))
|
||||
return float(result)
|
||||
else:
|
||||
result = Decimal('36000000000') / Decimal(str(total_equipment))
|
||||
return float(result)
|
||||
|
||||
return float(0)
|
||||
Loading…
Reference in New Issue