Updated claude big changes

This commit is contained in:
2026-01-29 08:43:56 -05:00
parent 2dbd3ea53f
commit eb4740c553
24 changed files with 388 additions and 429 deletions

View File

@@ -1,8 +1,8 @@
import logging
from flask import jsonify
from datetime import date, timedelta
from app.delivery_status import deliverystatus
from app import db
from app.common.responses import error_response, success_response
from sqlalchemy import func, case
from app.classes.delivery import (Delivery_Delivery,
@@ -53,8 +53,7 @@ def get_sidebar_counts():
transaction_count = db.session.query(Transaction).filter(Transaction.transaction_type == 0).count()
return jsonify({
"ok": True,
return success_response({
"counts": {
"today": today_count,
"tomorrow": tomorrow_count,
@@ -65,11 +64,10 @@ def get_sidebar_counts():
"today_service": today_service_count,
"transaction": transaction_count,
}
}), 200
})
except Exception as e:
# Basic error handling
return jsonify({"ok": False, "error": str(e)}), 500
return error_response(str(e), 500)
@deliverystatus.route("/tomorrow-totals", methods=["GET"])
@@ -91,14 +89,13 @@ def get_tomorrow_totals():
totals = [{'town': d.customer_town, 'gallons': int(d.total_gallons)} for d in deliveries]
grand_total = sum(d.total_gallons for d in deliveries)
result = {
return success_response({
'totals': totals,
'grand_total': int(grand_total)
}
return jsonify(result), 200
})
except Exception as e:
return jsonify({"ok": False, "error": str(e)}), 500
return error_response(str(e), 500)
@deliverystatus.route("/today-totals", methods=["GET"])
@@ -120,14 +117,13 @@ def get_today_totals():
totals = [{'town': d.customer_town, 'gallons': int(d.total_gallons)} for d in deliveries]
grand_total = sum(d.total_gallons for d in deliveries)
result = {
return success_response({
'totals': totals,
'grand_total': int(grand_total)
}
return jsonify(result), 200
})
except Exception as e:
return jsonify({"ok": False, "error": str(e)}), 500
return error_response(str(e), 500)
@deliverystatus.route("/waiting-totals", methods=["GET"])
@@ -149,11 +145,10 @@ def get_waiting_totals():
totals = [{'town': d.customer_town, 'gallons': int(d.total_gallons)} for d in deliveries]
grand_total = sum(d.total_gallons for d in deliveries)
result = {
return success_response({
'totals': totals,
'grand_total': int(grand_total)
}
return jsonify(result), 200
})
except Exception as e:
return jsonify({"ok": False, "error": str(e)}), 500
return error_response(str(e), 500)