Simplify db ORM method names

This commit is contained in:
3wc 2023-10-27 21:01:45 +01:00
parent 23e90a4413
commit 8908290c4d
2 changed files with 5 additions and 5 deletions

View File

@ -68,7 +68,7 @@ class ActivitiesScreen(ListScreen):
self.table.clear() self.table.clear()
# List activities with the count of facts # List activities with the count of facts
activities = Activity.list_activities(self.db_manager, filter_query) activities = Activity.list(self.db_manager, filter_query)
self.table.add_rows( self.table.add_rows(
[ [
@ -144,7 +144,7 @@ class CategoriesScreen(ListScreen):
def _refresh(self, filter_query=None): def _refresh(self, filter_query=None):
self.table.clear() self.table.clear()
categories = Category.list_categories( categories = Category.list(
self.db_manager, filter_query=filter_query self.db_manager, filter_query=filter_query
) )

View File

@ -38,7 +38,7 @@ class Category(BaseORM):
) )
@staticmethod @staticmethod
def list_categories(db_manager, filter_query=None): def list(db_manager, filter_query=None):
cursor = db_manager.get_cursor() cursor = db_manager.get_cursor()
where = "" where = ""
if filter_query is not None: if filter_query is not None:
@ -120,7 +120,7 @@ class Activity(BaseORM):
self.conn.commit() self.conn.commit()
@staticmethod @staticmethod
def list_activities(db_manager, filter_query=None): def list(db_manager, filter_query=None):
cursor = db_manager.get_cursor() cursor = db_manager.get_cursor()
where = "" where = ""
if filter_query is not None: if filter_query is not None:
@ -195,7 +195,7 @@ class Fact(BaseORM):
super().__init__(db_manager, "facts", id, activity_id=activity_id) super().__init__(db_manager, "facts", id, activity_id=activity_id)
@staticmethod @staticmethod
def list_facts(db_manager): def list(db_manager):
cursor = db_manager.get_cursor() cursor = db_manager.get_cursor()
cursor.execute("SELECT * FROM facts") cursor.execute("SELECT * FROM facts")
rows = cursor.fetchall() rows = cursor.fetchall()