Files
eamco_auto_api/app/script/update_auto.py
2024-11-20 18:00:33 -05:00

25 lines
1.0 KiB
Python

from decimal import Decimal
from database import session
def calc_home_factor(gallons_put_in_home, current_house_factor):
if 200.01 <= gallons_put_in_home <= 500:
customer_home_factor = Decimal(current_house_factor) + Decimal(1)
elif 170.01 <= gallons_put_in_home <= 200:
customer_home_factor = Decimal(current_house_factor) + Decimal(1.5)
elif 150.01 <= gallons_put_in_home <= 170:
customer_home_factor = Decimal(current_house_factor) + Decimal(1.25)
elif 120.01 <= gallons_put_in_home <= 150:
customer_home_factor = Decimal(current_house_factor) - Decimal(.25)
elif 90.01 <= gallons_put_in_home <= 120:
customer_home_factor = Decimal(current_house_factor) - Decimal(.50)
elif 0.01 <= gallons_put_in_home <= 90:
customer_home_factor = Decimal(current_house_factor) - Decimal(.75)
else:
customer_home_factor = Decimal(current_house_factor)
return customer_home_factor