Add All tag to dashboard as well

This commit is contained in:
Peter Stockings
2025-01-27 02:00:37 +11:00
parent 1e625ba7a8
commit 2a5afe51b4

12
db.py
View File

@@ -328,7 +328,7 @@ class DataBase():
person_id, tag_id], commit=True)
def get_tags_for_dashboard(self):
return self.execute("""
tags = self.execute("""
SELECT
T.tag_id AS "tag_id",
T.person_id AS "person_id",
@@ -340,6 +340,16 @@ class DataBase():
T.person_id IS NULL
ORDER BY
T.name""", [])
# Add the static 'All' entry at the beginning
all_tag = {
"tag_id": -1, # No specific ID for 'All'
"person_id": None,
"tag_name": "All", # Static name
"tag_filter": "" # No filter
}
return [all_tag] + tags
def add_or_update_tag_for_dashboard(self, tag_name, tag_filter):
# check if a tag exists for dashboard with the same tag_name