Updated time

This commit is contained in:
2025-09-05 11:39:49 -04:00
parent ca6e7ad778
commit 66f00aa7b5
2 changed files with 39 additions and 10 deletions

View File

@@ -35,6 +35,13 @@ def get_sidebar_counts():
upcoming_service_count = db.session.query(Service_Service).filter(Service_Service.scheduled_date >= now).count()
start_of_today = datetime.combine(today_date, datetime.min.time())
start_of_tomorrow = datetime.combine(today_date + timedelta(days=1), datetime.min.time())
today_service_count = db.session.query(Service_Service).filter(
Service_Service.scheduled_date >= start_of_today,
Service_Service.scheduled_date < start_of_tomorrow
).count()
return jsonify({
"ok": True,
"counts": {
@@ -44,9 +51,10 @@ def get_sidebar_counts():
"pending": pending_count,
"automatic": automatic_count,
"upcoming_service": upcoming_service_count,
"today_service": today_service_count,
}
}), 200
except Exception as e:
# Basic error handling
return jsonify({"ok": False, "error": str(e)}), 500
return jsonify({"ok": False, "error": str(e)}), 500