]> apps.delaporte.us Git - matrix-goal-bot.git/commitdiff
Add ability to list complete goals
authorEdward Delaporte <edward@delaporte.us>
Tue, 24 Mar 2026 04:20:13 +0000 (23:20 -0500)
committerEdward Delaporte <edward@delaporte.us>
Tue, 24 Mar 2026 04:20:13 +0000 (23:20 -0500)
bot.py
goals/db.py

diff --git a/bot.py b/bot.py
index efc56a5d9ee2c9a7af3a220e6e208ae7318e33e3..3cba5cfe3938d13b5cea379d5fc19db5078f5056 100644 (file)
--- a/bot.py
+++ b/bot.py
@@ -37,6 +37,7 @@ async def do_goal(match):
       add-task ID - add a task under the goal specified by ID
       list - list incomplete goals
       list-all - list everything
       add-task ID - add a task under the goal specified by ID
       list - list incomplete goals
       list-all - list everything
+      list-done - list completed goals
       print ID - print a goal and all tasks
       print-vision ID - print a vision and all goals
       done ID - mark task done by ID
       print ID - print a goal and all tasks
       print-vision ID - print a vision and all goals
       done ID - mark task done by ID
@@ -59,11 +60,20 @@ async def do_goal(match):
 
         if match.command('list'):
             goals = Data().get_all_goals()
 
         if match.command('list'):
             goals = Data().get_all_goals()
-            results = ['Goals list...']
+            results = ['# Goals list...']
             for goal in goals:
                 results.append(str(goal))
             return results
 
             for goal in goals:
                 results.append(str(goal))
             return results
 
+
+        if match.command('list-done'):
+            goals = Data().get_done_goals()
+            results = ['# Completed Goals...']
+            for goal in goals:
+                results.append(str(goal))
+            return results
+
+
         if match.command('add-task'):
             goal_id = int(match.args()[1])
             new = ' '.join(match.args()[2:])
         if match.command('add-task'):
             goal_id = int(match.args()[1])
             new = ' '.join(match.args()[2:])
index 6e539481dbe0184cd29906c56c65be43c3df0884..11b546773665e758eadcc77f478001892afb9e8b 100644 (file)
@@ -92,6 +92,13 @@ class Data():
             return session.exec(cmd).all()
 
 
             return session.exec(cmd).all()
 
 
+    def get_done_goals(self):
+        '''List all goals'''
+        with Session(self.engine) as session:
+            cmd = select(Goal).where(Goal.complete_date != None)
+            return session.exec(cmd).all()
+
+
     def get_goal(self, id):
         with Session(self.engine) as session:
             cmd = select(Goal).where(Goal.id == id)
     def get_goal(self, id):
         with Session(self.engine) as session:
             cmd = select(Goal).where(Goal.id == id)