When on overview page add a static tag that selects everything, will have to refactor tags functionality soon

This commit is contained in:
Peter Stockings
2025-01-27 01:57:36 +11:00
parent 6319e488e1
commit 1e625ba7a8

15
db.py
View File

@@ -287,7 +287,8 @@ class DataBase():
return all_topsets
def get_tags_for_person(self, person_id):
return self.execute("""
# Fetch tags from the database
tags = self.execute("""
SELECT
T.tag_id as "tag_id",
T.person_id as "person_id",
@@ -298,7 +299,17 @@ class DataBase():
WHERE
T.person_id = %s
ORDER BY
T.name""", [person_id])
T.name
""", [person_id])
# Add the static 'All' entry at the beginning
all_tag = {
"tag_id": -1, # No specific ID for 'All'
"person_id": person_id,
"tag_name": "All", # Static name
"tag_filter": "" # No filter
}
return [all_tag] + tags
def add_or_update_tag_for_person(self, person_id, tag_name, tag_filter):
# check if a tag exists for dashboard with the same tag_name