]> apps.delaporte.us Git - matrix-chore-bot.git/blobdiff - matrix_chore_bot/db.py
Update to support separate prefix and db file
[matrix-chore-bot.git] / matrix_chore_bot / db.py
index 536c9c08fb7640e056271763ab69d6bfb35acdfb..1a07bec5af581eae1c1f12d5be2420265443ac5c 100644 (file)
@@ -13,9 +13,6 @@ DATE_FORMAT = '%Y-%m-%d'
 def today():
     return dt.now().strftime(DATE_FORMAT)
 
-DEFAULT_DB_FILE = os.path.join(os.environ.get('MATRIX_DATA_DIR', ''), 'chores.db')
-DB_FILE = os.environ.get('MATRIX_CHORE_DB_FILE', DEFAULT_DB_FILE)
-
 logger = logging.getLogger(__name__)
 logging.basicConfig(filename='chore.log', encoding='utf-8', level=logging.DEBUG)
 
@@ -94,6 +91,17 @@ class Data():
                 results.append(Data.check_chore(session, chore.id))
         return results
 
+    def filter(self, term):
+        results = []
+        for item in self.list():
+            if term in item:
+                results.append(item)
+
+        return results
+        
+
+
+
     def add(self, name):
         try:
             with Session(self.engine) as session: