]> apps.delaporte.us Git - matrix-goal-bot.git/blobdiff - matrix_goal_bot/db.py
Allow completion of multiple tasks
[matrix-goal-bot.git] / matrix_goal_bot / db.py
index a47853369c80ea65af5ad583fcc9ce29bb77b752..cd2faa9db247aca583ebe8a0f475329a90e2bd62 100644 (file)
@@ -136,6 +136,17 @@ class Data():
             session.commit()
         return vision_id
 
             session.commit()
         return vision_id
 
+    def rename_goal(self, goal_id, name):
+        vision_id = -1
+        with Session(self.engine) as session:
+            cmd = select(Goal).where(Goal.id == goal_id)
+            goal = session.exec(cmd).first()
+            goal.name = name
+            vision_id = goal.vision_id
+            session.commit()
+        return vision_id
+
+
     def complete_task(self, id):
         with Session(self.engine) as session:
             cmd = select(Task).where(Task.id == id)
     def complete_task(self, id):
         with Session(self.engine) as session:
             cmd = select(Task).where(Task.id == id)
@@ -177,6 +188,13 @@ class Data():
             goal.vision_id = vision_id
             session.commit()
 
             goal.vision_id = vision_id
             session.commit()
 
+    def visionless(self):
+        '''Get goals with no vision'''
+        with Session(self.engine) as session:
+            cmd = select(Goal).where(Goal.vision_id  == None)
+            return session.exec(cmd).all()
+
+
     def add_note(self, note, goal):
         '''Notes print with the goal.'''
         pass
     def add_note(self, note, goal):
         '''Notes print with the goal.'''
         pass