major claude changes
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import logging
|
||||
from flask import jsonify
|
||||
from datetime import date, timedelta
|
||||
from app.delivery_status import deliverystatus
|
||||
@@ -13,6 +14,8 @@ from app.classes.transactions import Transaction
|
||||
from datetime import date, timedelta, datetime
|
||||
from zoneinfo import ZoneInfo
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
# --- NEW EFFICIENT ENDPOINT ---
|
||||
@deliverystatus.route("/stats/sidebar-counts", methods=["GET"])
|
||||
@@ -21,6 +24,7 @@ def get_sidebar_counts():
|
||||
Efficiently gets all counts needed for the navigation sidebar in a single request.
|
||||
This combines logic from all the individual /count/* endpoints.
|
||||
"""
|
||||
logger.info("GET /deliverystatus/stats/sidebar-counts - Fetching sidebar counts")
|
||||
try:
|
||||
eastern = ZoneInfo("America/New_York")
|
||||
now_local = datetime.now(eastern).replace(tzinfo=None) # naive local time
|
||||
@@ -73,6 +77,7 @@ def get_tomorrow_totals():
|
||||
"""
|
||||
Get total gallons by town for tomorrow's deliveries, including grand total.
|
||||
"""
|
||||
logger.info("GET /deliverystatus/tomorrow-totals - Fetching tomorrow delivery totals")
|
||||
try:
|
||||
deliveries = db.session.query(
|
||||
Delivery_Delivery.customer_town,
|
||||
@@ -101,6 +106,7 @@ def get_today_totals():
|
||||
"""
|
||||
Get total gallons by town for today's deliveries, including grand total.
|
||||
"""
|
||||
logger.info("GET /deliverystatus/today-totals - Fetching today delivery totals")
|
||||
try:
|
||||
deliveries = db.session.query(
|
||||
Delivery_Delivery.customer_town,
|
||||
@@ -129,6 +135,7 @@ def get_waiting_totals():
|
||||
"""
|
||||
Get total gallons by town for waiting deliveries, including grand total.
|
||||
"""
|
||||
logger.info("GET /deliverystatus/waiting-totals - Fetching waiting delivery totals")
|
||||
try:
|
||||
deliveries = db.session.query(
|
||||
Delivery_Delivery.customer_town,
|
||||
|
||||
Reference in New Issue
Block a user