small fixes
This commit is contained in:
@@ -39,13 +39,14 @@ async def update_auto(autoid: int, request: Request):
|
|||||||
new_home_factor = calc_home_factor(gallons_put_in_home = gallons_put_in_home,
|
new_home_factor = calc_home_factor(gallons_put_in_home = gallons_put_in_home,
|
||||||
current_house_factor=customer_home_factor)
|
current_house_factor=customer_home_factor)
|
||||||
|
|
||||||
|
gallons_left_buffer = get_auto_delivery.tank_size - 30
|
||||||
|
|
||||||
|
|
||||||
get_auto_delivery.house_factor = new_home_factor
|
get_auto_delivery.house_factor = new_home_factor
|
||||||
get_auto_delivery.tank_height = 'Full'
|
get_auto_delivery.tank_height = 'Full'
|
||||||
get_auto_delivery.last_fill = date.today()
|
get_auto_delivery.last_fill = date.today()
|
||||||
get_auto_delivery.estimated_gallons_left = 240
|
get_auto_delivery.estimated_gallons_left = gallons_left_buffer
|
||||||
get_auto_delivery.estimated_gallons_left_prev_day = 240
|
get_auto_delivery.estimated_gallons_left_prev_day = gallons_left_buffer
|
||||||
get_auto_delivery.auto_status = 1
|
get_auto_delivery.auto_status = 1
|
||||||
get_auto_delivery.days_since_last_fill = 0
|
get_auto_delivery.days_since_last_fill = 0
|
||||||
|
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ def get_delivery_customers():
|
|||||||
automatics = (
|
automatics = (
|
||||||
session.query(Auto_Delivery)
|
session.query(Auto_Delivery)
|
||||||
.filter(Auto_Delivery.auto_status == 1)
|
.filter(Auto_Delivery.auto_status == 1)
|
||||||
.order_by(Auto_Delivery.estimated_gallons_left.desc())
|
.order_by(Auto_Delivery.estimated_gallons_left.asc())
|
||||||
.all()
|
.all()
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ def update_auto_customers():
|
|||||||
elif 5.01 <= today_temptemp_avg <= 10:
|
elif 5.01 <= today_temptemp_avg <= 10:
|
||||||
use_day = 10
|
use_day = 10
|
||||||
elif 0.01 <= today_temptemp_avg <= 5:
|
elif 0.01 <= today_temptemp_avg <= 5:
|
||||||
use_day =12
|
use_day = 12
|
||||||
elif -20 <= today_temptemp_avg <= -1:
|
elif -20 <= today_temptemp_avg <= -1:
|
||||||
use_day = 15
|
use_day = 15
|
||||||
else:
|
else:
|
||||||
@@ -98,7 +98,7 @@ def update_auto_customers():
|
|||||||
|
|
||||||
|
|
||||||
f.estimated_gallons_left = get_gallons_left
|
f.estimated_gallons_left = get_gallons_left
|
||||||
|
f.last_updated = date.today()
|
||||||
session.add(create_new_update)
|
session.add(create_new_update)
|
||||||
session.add(f)
|
session.add(f)
|
||||||
session.commit()
|
session.commit()
|
||||||
|
|||||||
@@ -21,5 +21,6 @@ def calc_home_factor(gallons_put_in_home, current_house_factor):
|
|||||||
customer_home_factor = Decimal(current_house_factor) - Decimal(.75)
|
customer_home_factor = Decimal(current_house_factor) - Decimal(.75)
|
||||||
else:
|
else:
|
||||||
customer_home_factor = Decimal(current_house_factor)
|
customer_home_factor = Decimal(current_house_factor)
|
||||||
|
if customer_home_factor <= 0:
|
||||||
|
customer_home_factor = Decimal(.25)
|
||||||
return customer_home_factor
|
return customer_home_factor
|
||||||
Reference in New Issue
Block a user