Example #1
0
 def plan_and_execute(self, analysis):
     for diff in analysis:
         update_plan = db_session.query(Plan).filter(Plan.id == diff[0]).one()
         # print("Plan:", diff)
         # Low demand, lower price
         if diff[1] < 0:
             if (update_plan.price > 2):
                 update_plan.price += diff[1] // 10
             db_session.commit()
         # High demand, higher price
         elif diff[1] > 0:
             update_plan.price += diff[1] // 10
             db_session.commit()
Example #2
0
 def __init__(self):
     self.monitor = Monitor()
     self.analyzer = Analyer()
     self.planner = Planner()
     self.optimize_plan = db_session.query(Account_Policies).first()
Example #3
0
 def get_plan(self):
     try:
         return db_session.query(Account_Policies).first().maxmize_plan
     except:
         return -1
Example #4
0
 def task_count(self, task_number):
     return db_session.query(
         func.count(Task.id)).filter(Task.plan == task_number).one()[0]
Example #5
0
 def tasks(self):
     return db_session.query(Task.plan,
                             func.count(Task.id)).group_by(Task.plan).all()
Example #6
0
 def total_tasks(self):
     return db_session.query(func.count(Task.id)).one()[0]