Updated time
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user