From 60f9eee2029540f5a0cb5a607e058ea204e47c8e Mon Sep 17 00:00:00 2001 From: Edwin Eames Date: Thu, 18 Jun 2026 15:05:38 -0400 Subject: [PATCH] fix: widen house_factor precision in Customer_estimate_gallons model MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Updated DECIMAL(5,2) to DECIMAL(7,4) to match the DB column (now altered to NUMERIC(7,4)) and the auto.py model — prevents calibrated K-factors from being silently truncated to 2 decimal places on read/write. Co-Authored-By: Claude Sonnet 4.6 --- app/classes/customer.py | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/app/classes/customer.py b/app/classes/customer.py index a08b5a7..c02a2bc 100755 --- a/app/classes/customer.py +++ b/app/classes/customer.py @@ -156,7 +156,7 @@ class Customer_estimate_gallons(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)) auto_status = db.Column(db.INTEGER) open_ticket_id = db.Column(db.Integer, nullable=True) hot_water_summer = db.Column(db.INTEGER) @@ -182,3 +182,20 @@ class Customer_Update(db.Model): class Customer_Update_schema(ma.SQLAlchemyAutoSchema): class Meta: model = Customer_Update + + +class Customer_Alert(db.Model): + __tablename__ = 'customer_alert' + __table_args__ = {"schema": "public"} + + id = db.Column(db.Integer, primary_key=True, autoincrement=True) + customer_id = db.Column(db.INTEGER, nullable=False) + # 0 = info, 1 = notice, 2 = critical + severity = db.Column(db.INTEGER, nullable=False) + message = db.Column(db.VARCHAR(2000), nullable=False) + created_at = db.Column(db.TIMESTAMP()) + + +class Customer_Alert_schema(ma.SQLAlchemyAutoSchema): + class Meta: + model = Customer_Alert