Add All tag to dashboard as well
This commit is contained in:
12
db.py
12
db.py
@@ -328,7 +328,7 @@ class DataBase():
|
|||||||
person_id, tag_id], commit=True)
|
person_id, tag_id], commit=True)
|
||||||
|
|
||||||
def get_tags_for_dashboard(self):
|
def get_tags_for_dashboard(self):
|
||||||
return self.execute("""
|
tags = self.execute("""
|
||||||
SELECT
|
SELECT
|
||||||
T.tag_id AS "tag_id",
|
T.tag_id AS "tag_id",
|
||||||
T.person_id AS "person_id",
|
T.person_id AS "person_id",
|
||||||
@@ -341,6 +341,16 @@ class DataBase():
|
|||||||
ORDER BY
|
ORDER BY
|
||||||
T.name""", [])
|
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):
|
def add_or_update_tag_for_dashboard(self, tag_name, tag_filter):
|
||||||
# check if a tag exists for dashboard with the same tag_name
|
# check if a tag exists for dashboard with the same tag_name
|
||||||
tag = self.execute('SELECT tag_id AS "tag_id" FROM Tag WHERE person_id IS NULL AND name=%s LIMIT 1', [
|
tag = self.execute('SELECT tag_id AS "tag_id" FROM Tag WHERE person_id IS NULL AND name=%s LIMIT 1', [
|
||||||
|
|||||||
Reference in New Issue
Block a user