fixed service calls

This commit is contained in:
2025-09-27 09:44:21 -04:00
parent 10d82cf81a
commit 19f5c70735

View File

@@ -35,8 +35,6 @@ def get_sidebar_counts():
pending_count = db.session.query(Delivery_Delivery).filter(Delivery_Delivery.delivery_status == 9).count() pending_count = db.session.query(Delivery_Delivery).filter(Delivery_Delivery.delivery_status == 9).count()
automatic_count = db.session.query(Auto_Delivery).filter(Auto_Delivery.estimated_gallons_left <= 80).count() automatic_count = db.session.query(Auto_Delivery).filter(Auto_Delivery.estimated_gallons_left <= 80).count()
upcoming_service_count = db.session.query(Service_Service).filter(Service_Service.scheduled_date >= now_local).count()
start_of_today = datetime.combine(today_date, datetime.min.time()) start_of_today = datetime.combine(today_date, datetime.min.time())
start_of_tomorrow = datetime.combine(today_date + timedelta(days=1), datetime.min.time()) start_of_tomorrow = datetime.combine(today_date + timedelta(days=1), datetime.min.time())
@@ -45,6 +43,9 @@ def get_sidebar_counts():
Service_Service.scheduled_date < start_of_tomorrow Service_Service.scheduled_date < start_of_tomorrow
).count() ).count()
# Upcoming service calls start from tomorrow, not today
upcoming_service_count = db.session.query(Service_Service).filter(Service_Service.scheduled_date >= start_of_tomorrow).count()
transaction_count = db.session.query(Transaction).filter(Transaction.transaction_type == 0).count() transaction_count = db.session.query(Transaction).filter(Transaction.transaction_type == 0).count()
return jsonify({ return jsonify({