feat: 5-tier pricing, market ticker integration, and delivery stats
Major update spanning pricing, market data, and analytics: - Pricing: Replace single-price service fees with 5-tier pricing for same-day, prime, and emergency deliveries across create/edit/finalize - Market: Add Ticker_Price and CompanyPrice models with endpoints for live commodity prices (HO, CL, RB) and competitor price tracking - Stats: Add daily/weekly/monthly gallons endpoints with multi-year comparison and YoY totals for the stats dashboard - Delivery: Add map and history endpoints, fix finalize null-driver crash - Schema: Change fill_location from INTEGER to VARCHAR(250), add pre_load normalization for customer updates, fix admin auth check Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -17,7 +17,7 @@ class Auto_Update(db.Model):
|
||||
class Auto_Temp(db.Model):
|
||||
__tablename__ = 'auto_temp'
|
||||
__table_args__ = {"schema": "public"}
|
||||
|
||||
|
||||
id = db.Column(db.Integer,
|
||||
primary_key=True,
|
||||
autoincrement=True,
|
||||
@@ -38,7 +38,7 @@ class Auto_Temp_schema(ma.SQLAlchemyAutoSchema):
|
||||
class Auto_Delivery(db.Model):
|
||||
__tablename__ = 'auto_delivery'
|
||||
__table_args__ = {"schema": "public"}
|
||||
|
||||
|
||||
id = db.Column(db.Integer,
|
||||
primary_key=True,
|
||||
autoincrement=True,
|
||||
@@ -57,12 +57,14 @@ class Auto_Delivery(db.Model):
|
||||
estimated_gallons_left_prev_day = db.Column(db.DECIMAL(6, 2))
|
||||
tank_height = db.Column(db.VARCHAR(25))
|
||||
tank_size = db.Column(db.VARCHAR(25))
|
||||
house_factor = db.Column(db.DECIMAL(5, 2))
|
||||
house_factor = db.Column(db.DECIMAL(7, 4))
|
||||
hot_water_summer = db.Column(db.Integer)
|
||||
#0 = waiting
|
||||
#1 = waiting for delivery
|
||||
auto_status = db.Column(db.INTEGER())
|
||||
open_ticket_id = db.Column(db.Integer)
|
||||
confidence_score = db.Column(db.Integer, default=20)
|
||||
k_factor_source = db.Column(db.VARCHAR(20), default='default')
|
||||
|
||||
|
||||
class Auto_Delivery_schema(ma.SQLAlchemyAutoSchema):
|
||||
@@ -73,7 +75,7 @@ class Auto_Delivery_schema(ma.SQLAlchemyAutoSchema):
|
||||
class Tickets_Auto_Delivery(db.Model):
|
||||
__tablename__ = 'auto_tickets'
|
||||
__table_args__ = {"schema": "public"}
|
||||
|
||||
|
||||
id = db.Column(db.Integer,
|
||||
primary_key=True,
|
||||
autoincrement=True,
|
||||
@@ -98,8 +100,9 @@ class Tickets_Auto_Delivery(db.Model):
|
||||
payment_type = db.Column(db.INTEGER, nullable=True)
|
||||
payment_card_id = db.Column(db.INTEGER, nullable=True)
|
||||
payment_status = db.Column(db.INTEGER, nullable=True)
|
||||
is_budget_fill = db.Column(db.Boolean, default=False)
|
||||
|
||||
|
||||
|
||||
class Tickets_Auto_Delivery_schema(ma.SQLAlchemyAutoSchema):
|
||||
class Meta:
|
||||
model = Tickets_Auto_Delivery
|
||||
|
||||
Reference in New Issue
Block a user