bug fixes. added auto table
This commit is contained in:
@@ -39,7 +39,7 @@ async def update_auto(autoid: int, request: Request):
|
||||
new_home_factor = calc_home_factor(gallons_put_in_home = gallons_put_in_home,
|
||||
current_house_factor=customer_home_factor)
|
||||
|
||||
gallons_left_buffer = get_auto_delivery.tank_size - 30
|
||||
gallons_left_buffer = int(get_auto_delivery.tank_size) - 30
|
||||
|
||||
|
||||
get_auto_delivery.house_factor = new_home_factor
|
||||
@@ -80,18 +80,18 @@ async def create_auto_ticket(autoid: int, request: Request):
|
||||
total_amount = gallons_put_in_home * todays_price
|
||||
|
||||
create_new_ticket = Tickets_Auto_Delivery(
|
||||
|
||||
customer_id = get_auto_delivery.customer_id,
|
||||
account_number = get_auto_delivery.account_number,
|
||||
customer_town = get_auto_delivery.customer_town,
|
||||
customer_state = get_auto_delivery.customer_state,
|
||||
customer_address = get_auto_delivery.customer_address,
|
||||
customer_zip =get_auto_delivery.customer_zip,
|
||||
customer_full_name = get_auto_delivery.customer_full_name,
|
||||
oil_prices_id = get_todays_price.id,
|
||||
gallons_delivered = gallons_delivered,
|
||||
price_per_gallon = get_todays_price.price_for_customer,
|
||||
total_amount_customer = total_amount,
|
||||
customer_id = get_auto_delivery.customer_id,
|
||||
account_number = get_auto_delivery.account_number,
|
||||
customer_town = get_auto_delivery.customer_town,
|
||||
customer_state = get_auto_delivery.customer_state,
|
||||
customer_address = get_auto_delivery.customer_address,
|
||||
customer_zip =get_auto_delivery.customer_zip,
|
||||
customer_full_name = get_auto_delivery.customer_full_name,
|
||||
oil_prices_id = get_todays_price.id,
|
||||
gallons_delivered = gallons_delivered,
|
||||
price_per_gallon = get_todays_price.price_for_customer,
|
||||
total_amount_customer = total_amount,
|
||||
fill_date = date.today(),
|
||||
)
|
||||
|
||||
|
||||
|
||||
@@ -68,3 +68,14 @@ def get_delivery(delivery_id_order):
|
||||
return JSONResponse(content=jsonable_encoder(get_delivery), status_code=200)
|
||||
|
||||
|
||||
@router.get("/all/profile/{customer_id}", status_code=200)
|
||||
def get_autos_customers(customer_id):
|
||||
|
||||
get_delivery = (
|
||||
session.query(Tickets_Auto_Delivery)
|
||||
.filter(Tickets_Auto_Delivery.customer_id == customer_id)
|
||||
.order_by(Tickets_Auto_Delivery.id.asc())
|
||||
.all()
|
||||
)
|
||||
|
||||
return JSONResponse(content=jsonable_encoder(get_delivery), status_code=200)
|
||||
@@ -46,6 +46,7 @@ def update_auto_customers():
|
||||
# get all automatic customers
|
||||
auto_customers = (session
|
||||
.query(Auto_Delivery)
|
||||
.filter(Auto_Delivery.last_fill != None)
|
||||
.order_by(Auto_Delivery.last_updated.desc())
|
||||
.limit(25))
|
||||
|
||||
@@ -53,6 +54,7 @@ def update_auto_customers():
|
||||
|
||||
# figure out days since last fill
|
||||
d1 = date.today()
|
||||
|
||||
d0 = f.last_fill
|
||||
|
||||
delta = d1 - d0
|
||||
|
||||
Reference in New Issue
Block a user