first commit
This commit is contained in:
26
app/script/update_auto.py
Normal file
26
app/script/update_auto.py
Normal file
@@ -0,0 +1,26 @@
|
||||
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)
|
||||
if customer_home_factor <= 0:
|
||||
customer_home_factor = Decimal(.25)
|
||||
return customer_home_factor
|
||||
Reference in New Issue
Block a user