Browse Source

Added Service Class overrides for village CIS.

Signed-off-by: Alan Woodman <alan@awoodman.net>
master
Alan Woodman 9 months ago
parent
commit
c8c28e57dc
  1. 10
      main.py
  2. 1
      models.py

10
main.py

@ -30,8 +30,9 @@ def service_qualify():
try: try:
location = ( location = (
db.session.query(Locations, ParentLocations) db.session.query(Locations, ParentLocations, PlanGroups)
.join(Locations, Locations.ParentLocation_ID == ParentLocations.id) .join(Locations, Locations.ParentLocation_ID == ParentLocations.id)
.join(PlanGroups, PlanGroups.id == ParentLocations.PlanGroup_ID)
.filter(Locations.LocationIdentifier == locid) .filter(Locations.LocationIdentifier == locid)
.first() .first()
) )
@ -52,12 +53,17 @@ def service_qualify():
.all() .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] plan_list = [plan.Plans.PlanIdentifier for plan in plans]
return jsonify({ return jsonify({
"locid": locid, "locid": locid,
"status": True, "status": True,
"serviceclass": location.Locations.ServiceClass, "serviceclass": serviceclass,
"newDevelopmentFeeApplicable": 30000, "newDevelopmentFeeApplicable": 30000,
"unitidentifier": location.Locations.UnitIdentifier, "unitidentifier": location.Locations.UnitIdentifier,
"streetaddress": location.Locations.StreetAddress, "streetaddress": location.Locations.StreetAddress,

1
models.py

@ -72,6 +72,7 @@ class PlanGroups(db.Model):
__tablename__ = 'PlanGroups' __tablename__ = 'PlanGroups'
id = db.Column(db.Integer, primary_key=True) id = db.Column(db.Integer, primary_key=True)
Name = db.Column(db.String(255)) Name = db.Column(db.String(255))
ServiceClass_Override = db.Column(db.Integer)
class Plans2Groups(db.Model): class Plans2Groups(db.Model):
__tablename__ = 'Plans2Groups' __tablename__ = 'Plans2Groups'

Loading…
Cancel
Save