small fixes
This commit is contained in:
@@ -183,21 +183,57 @@ def create_customer():
|
||||
the_state = 'MA'
|
||||
elif response_customer_state == 1:
|
||||
the_state = 'RI'
|
||||
elif response_customer_state == 1:
|
||||
elif response_customer_state == 2:
|
||||
the_state = 'NH'
|
||||
else:
|
||||
the_state = 'MA'
|
||||
|
||||
if response_customer_town == 0:
|
||||
the_town = 'Auburn'
|
||||
elif response_customer_state == 1:
|
||||
the_town = 'Charlton'
|
||||
elif response_customer_state == 2:
|
||||
the_town = 'Cherry Valley'
|
||||
elif response_customer_state == 3:
|
||||
the_town = 'Dudley'
|
||||
elif response_customer_state == 4:
|
||||
the_town = 'Grafton'
|
||||
elif response_customer_state == 5:
|
||||
the_town = 'Leicester'
|
||||
elif response_customer_state == 6:
|
||||
the_town = 'Millbury'
|
||||
elif response_customer_state == 7:
|
||||
the_town = 'N Oxford'
|
||||
elif response_customer_state == 8:
|
||||
the_town = 'Oxford'
|
||||
elif response_customer_state == 9:
|
||||
the_town = 'Rochdale'
|
||||
elif response_customer_state == 10:
|
||||
the_town = 'Shrewsbury'
|
||||
elif response_customer_state == 11:
|
||||
the_town = 'Southbridge'
|
||||
elif response_customer_state == 12:
|
||||
the_town = 'Spencer'
|
||||
elif response_customer_state == 13:
|
||||
the_town = 'Sturbridge'
|
||||
elif response_customer_state == 14:
|
||||
the_town = 'Webster'
|
||||
elif response_customer_state == 15:
|
||||
the_town = 'Worcester'
|
||||
else:
|
||||
the_town = 'NA'
|
||||
|
||||
|
||||
geolocator = Nominatim(user_agent="auburnoil")
|
||||
address_string = customer_address + ' ' + response_customer_town + the_state + response_customer_zip
|
||||
address_string = customer_address + ' ' + response_customer_town+ ' ' + the_state
|
||||
try:
|
||||
location = geolocator.geocode(address_string)
|
||||
user_lat =location.latitude
|
||||
user_long = location.longitude
|
||||
cor_ad = True
|
||||
except:
|
||||
user_lat =location.latitude
|
||||
user_long = location.longitude
|
||||
user_lat =None
|
||||
user_long = None
|
||||
cor_ad = False
|
||||
|
||||
new_customer = Customer_Customer(
|
||||
@@ -437,7 +473,10 @@ def customer_automatic_assignment(customer_id):
|
||||
.filter(Card_Card.main_card == True)
|
||||
.first())
|
||||
|
||||
|
||||
get_customer_tank = (db.session
|
||||
.query(Customer_Tank_Inspection)
|
||||
.filter(Customer_Tank_Inspection.customer_id == customer_id)
|
||||
.first())
|
||||
if get_customer.customer_automatic == 1:
|
||||
# customer becomes will call
|
||||
get_customer.customer_automatic = 0
|
||||
@@ -458,7 +497,7 @@ def customer_automatic_assignment(customer_id):
|
||||
|
||||
# customer becames an automatic
|
||||
if get_auto is None:
|
||||
create_auto = Auto_Delivery(customer_id = customer_id,
|
||||
create_auto = Auto_Delivery(customer_id=customer_id,
|
||||
customer_full_name =get_customer.customer_first_name + ' ' + get_customer.customer_last_name,
|
||||
account_number=get_customer.account_number,
|
||||
customer_town=get_customer.customer_town,
|
||||
@@ -470,13 +509,15 @@ def customer_automatic_assignment(customer_id):
|
||||
estimated_gallons_left = 0,
|
||||
estimated_gallons_left_prev_day = 0,
|
||||
tank_height = 0,
|
||||
tank_size =275,
|
||||
tank_size = get_customer_tank.tank_size,
|
||||
house_factor = 1,
|
||||
auto_status=1,
|
||||
days_since_last_fill=0
|
||||
|
||||
)
|
||||
|
||||
db.session.add(create_auto)
|
||||
|
||||
|
||||
get_customer.customer_automatic = 1
|
||||
db.session.add(get_customer)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user