major claude changes
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import logging
|
||||
from fastapi import APIRouter
|
||||
from fastapi.responses import JSONResponse
|
||||
from fastapi.encoders import jsonable_encoder
|
||||
@@ -10,6 +11,8 @@ from app.models.customer import Customer_Customer, Customer_estimate_gallons
|
||||
from app.models.delivery import Delivery
|
||||
from app.models.auto import Auto_Temp
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
# Constants from fuel_estimator
|
||||
HOT_WATER_DAILY_USAGE = Decimal('1.0')
|
||||
K_FACTOR_SMOOTHING_WEIGHT = Decimal('0.7')
|
||||
@@ -42,6 +45,7 @@ def fix_customer_last_delivered():
|
||||
|
||||
Returns statistics and a list of changes made.
|
||||
"""
|
||||
logger.info("GET /fixstuff_customer/lastdelivered - Fixing customer last delivered dates")
|
||||
session.rollback() # Reset any aborted transaction state
|
||||
customer_estimates = session.query(Customer_estimate_gallons).all()
|
||||
changes = []
|
||||
@@ -87,6 +91,7 @@ def estimate_customer_gallons(update_db: int):
|
||||
Multiple deliveries: use historical average. Includes address and scaling factor.
|
||||
When update_db=1, updates estimated_gallons_left and house_factor in database.
|
||||
"""
|
||||
logger.info(f"GET /fixstuff_customer/estimate_gallons/{update_db} - Estimating customer gallons (update_db={update_db})")
|
||||
session.rollback() # Reset any aborted transaction state
|
||||
|
||||
# Check if weather data is available
|
||||
@@ -235,6 +240,7 @@ def estimate_customer_gallons_specific(customer_id: int):
|
||||
Estimates current gallons for a specific regular customer based on delivery history and weather.
|
||||
Returns estimation data for the specified customer only.
|
||||
"""
|
||||
logger.info(f"GET /fixstuff_customer/estimate_gallons/customer/{customer_id} - Estimating gallons for specific customer")
|
||||
session.rollback() # Reset any aborted transaction state
|
||||
|
||||
# Check if weather data is available
|
||||
@@ -386,6 +392,7 @@ def populate_customer_estimates():
|
||||
|
||||
Returns statistics on records created.
|
||||
"""
|
||||
logger.info("GET /fixstuff_customer/populate_estimates - Populating customer estimates")
|
||||
session.rollback() # Reset any aborted transaction state
|
||||
|
||||
# Get all regular customers (customer_automatic == 0)
|
||||
|
||||
Reference in New Issue
Block a user