]> apps.delaporte.us Git - matrix-goal-bot.git/commitdiff
Add visionless command
authorEdward Delaporte <edward@delaporte.us>
Fri, 3 Apr 2026 18:14:41 +0000 (13:14 -0500)
committerEdward Delaporte <edward@delaporte.us>
Fri, 3 Apr 2026 18:14:41 +0000 (13:14 -0500)
matrix_goal_bot/bot.py
matrix_goal_bot/db.py
matrix_goal_bot/tasks.py

index 957051c785f516e50764754af3c7251a7fe7b455..8c8183c386ef42ff9c0b849ca1b92d2fee33f00c 100644 (file)
@@ -142,6 +142,15 @@ async def do_goal(match):
             results.append(item)
         return results
 
             results.append(item)
         return results
 
+    if match.command('visions'):
+        items = Data().visionless()
+        results = ['# Goals with no vision']
+        if not items:
+            results.append('-- No visionless goals --')
+
+        for item in items:
+            results.append(item)
+        return results
 
     if match.command('set-vision'):
         goal_id = int(match.args()[1])
 
     if match.command('set-vision'):
         goal_id = int(match.args()[1])
index a47853369c80ea65af5ad583fcc9ce29bb77b752..97ea2c05b623038dffefdc2d6e36999a78f3fccc 100644 (file)
@@ -177,6 +177,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
index 440afb4790e9eae447ca2fa2c20e618c745e1c99..5e85d18a8f165d5bbf8649b5584e36a9a4346cc6 100644 (file)
@@ -25,6 +25,13 @@ def list(c):
         print(goal)
 
 
         print(goal)
 
 
+@task
+def visionless(c):
+    goals = Data().visionless()
+    for goal in goals:
+        print(goal)
+
+
 @task
 def list_done(c):
     goals = Data().get_done_goals()
 @task
 def list_done(c):
     goals = Data().get_done_goals()