bug fixes. added auto table

This commit is contained in:
2024-12-28 15:54:08 -05:00
parent e6f85ff014
commit 98a2c94083
2 changed files with 87 additions and 63 deletions

View File

@@ -84,7 +84,7 @@ class Tickets_Auto_Delivery(db.Model):
customer_address = db.Column(db.VARCHAR(1000)) customer_address = db.Column(db.VARCHAR(1000))
customer_zip = db.Column(db.VARCHAR(25)) customer_zip = db.Column(db.VARCHAR(25))
customer_full_name = db.Column(db.VARCHAR(250)) customer_full_name = db.Column(db.VARCHAR(250))
fill_date = db.Column(db.DATE())
oil_prices_id = db.Column(db.INTEGER()) oil_prices_id = db.Column(db.INTEGER())
gallons_delivered = db.Column(db.DECIMAL(6, 2)) gallons_delivered = db.Column(db.DECIMAL(6, 2))

View File

@@ -179,6 +179,7 @@ def create_customer():
response_customer_zip = str(response_customer_zip) response_customer_zip = str(response_customer_zip)
response_customer_state = int(response_customer_state) response_customer_state = int(response_customer_state)
if response_customer_state == 0: if response_customer_state == 0:
the_state = 'MA' the_state = 'MA'
elif response_customer_state == 1: elif response_customer_state == 1:
@@ -236,6 +237,20 @@ def create_customer():
user_long = None user_long = None
cor_ad = False cor_ad = False
see_if_customer_exists = (db.session
.query(Customer_Customer)
.filter(Customer_Customer.response_customer_last_name)
.filter(Customer_Customer.response_customer_first_name)
.filter(Customer_Customer.customer_phone_number)
.first())
if see_if_customer_exists is not None:
return jsonify({
"ok": False,
'customer': see_if_customer_exists.id
}), 200
else:
new_customer = Customer_Customer( new_customer = Customer_Customer(
account_number=made_account_number, account_number=made_account_number,
customer_last_name=response_customer_last_name, customer_last_name=response_customer_last_name,
@@ -477,6 +492,7 @@ def customer_automatic_assignment(customer_id):
.query(Customer_Tank_Inspection) .query(Customer_Tank_Inspection)
.filter(Customer_Tank_Inspection.customer_id == customer_id) .filter(Customer_Tank_Inspection.customer_id == customer_id)
.first()) .first())
if get_customer.customer_automatic == 1: if get_customer.customer_automatic == 1:
# customer becomes will call # customer becomes will call
get_customer.customer_automatic = 0 get_customer.customer_automatic = 0
@@ -547,8 +563,14 @@ def edit_customer_tank(customer_id):
.query(Customer_Tank_Inspection) .query(Customer_Tank_Inspection)
.filter(Customer_Tank_Inspection.customer_id == customer_id) .filter(Customer_Tank_Inspection.customer_id == customer_id)
.first()) .first())
get_auto_info = (db.session
.query(Auto_Delivery)
.filter(Auto_Delivery.customer_id == customer_id)
.first())
response_tank_status = request.json["tank_status"] response_tank_status = request.json["tank_status"]
if response_tank_status == 'true': if response_tank_status == 'true':
get_customer_tank.tank_status = True get_customer_tank.tank_status = True
@@ -574,9 +596,11 @@ def edit_customer_tank(customer_id):
get_customer_tank.last_tank_inspection = response_last_tank_inspection get_customer_tank.last_tank_inspection = response_last_tank_inspection
get_customer_tank.tank_size = response_tank_size get_customer_tank.tank_size = response_tank_size
get_auto_info.tank_size = response_tank_size
get_customer_description.fill_location = response_customer_fill_location get_customer_description.fill_location = response_customer_fill_location
db.session.add(get_customer_description) db.session.add(get_customer_description)
db.session.add(get_customer) db.session.add(get_customer)