diff --git a/main.py b/main.py index a983e2e..a5b9d6f 100644 --- a/main.py +++ b/main.py @@ -30,8 +30,9 @@ def service_qualify(): try: location = ( - db.session.query(Locations, ParentLocations) + db.session.query(Locations, ParentLocations, PlanGroups) .join(Locations, Locations.ParentLocation_ID == ParentLocations.id) + .join(PlanGroups, PlanGroups.id == ParentLocations.PlanGroup_ID) .filter(Locations.LocationIdentifier == locid) .first() ) @@ -52,12 +53,17 @@ def service_qualify(): .all() ) + if location.PlanGroups.ServiceClass_Override is not None: + serviceclass = location.PlanGroups.ServiceClass_Override + else: + serviceclass = location.Locations.ServiceClass + plan_list = [plan.Plans.PlanIdentifier for plan in plans] return jsonify({ "locid": locid, "status": True, - "serviceclass": location.Locations.ServiceClass, + "serviceclass": serviceclass, "newDevelopmentFeeApplicable": 30000, "unitidentifier": location.Locations.UnitIdentifier, "streetaddress": location.Locations.StreetAddress, diff --git a/models.py b/models.py index 493916c..4b25394 100644 --- a/models.py +++ b/models.py @@ -72,6 +72,7 @@ class PlanGroups(db.Model): __tablename__ = 'PlanGroups' id = db.Column(db.Integer, primary_key=True) Name = db.Column(db.String(255)) + ServiceClass_Override = db.Column(db.Integer) class Plans2Groups(db.Model): __tablename__ = 'Plans2Groups'