fix: [tags] fix UI enabled tags selector

This commit is contained in:
Terrtia 2023-04-05 10:26:21 +02:00
parent d2fdc6107e
commit 5cfe7fffc9
No known key found for this signature in database
GPG key ID: 1E1B1F50D84613D0

View file

@ -846,15 +846,16 @@ def get_all_custom_tags(): # # TODO: add + REMOVE + Update
def get_taxonomies_enabled_tags(r_list=False): def get_taxonomies_enabled_tags(r_list=False):
l_tag_keys = [] l_tag_keys = []
for taxonomie in get_active_taxonomies(): for taxonomy in get_active_taxonomies():
l_tag_keys.append(f'active_tag_{taxonomie}') l_tag_keys.append(f'taxonomy:tags:enabled:{taxonomy}')
if len(l_tag_keys) > 1: if len(l_tag_keys) > 1:
res = r_tags.sunion(l_tag_keys[0], *l_tag_keys[1:]) res = r_tags.sunion(l_tag_keys[0], *l_tag_keys[1:])
elif l_tag_keys: elif l_tag_keys:
res = r_tags.smembers(l_tag_keys[0]) res = r_tags.smembers(l_tag_keys[0])
else:
res = []
#### # WARNING: # TODO: DIRTY FIX, REPLACE WITH LOCAL TAGS #### #### # WARNING: # TODO: DIRTY FIX, REPLACE WITH LOCAL TAGS ####
if r_list: if r_list:
return list(res) return list(res)
else: else:
@ -863,7 +864,7 @@ def get_taxonomies_enabled_tags(r_list=False):
def get_galaxies_enabled_tags(): def get_galaxies_enabled_tags():
l_tag_keys = [] l_tag_keys = []
for galaxy in get_active_galaxies(): for galaxy in get_active_galaxies():
l_tag_keys.append(f'active_tag_galaxies_{galaxy}') l_tag_keys.append(f'galaxy:tags:enabled:{galaxy}')
if len(l_tag_keys) > 1: if len(l_tag_keys) > 1:
return r_tags.sunion(l_tag_keys[0], *l_tag_keys[1:]) return r_tags.sunion(l_tag_keys[0], *l_tag_keys[1:])
elif l_tag_keys: elif l_tag_keys:
@ -884,20 +885,30 @@ def get_taxonomies_customs_tags(r_list=False):
tags = list(tags) tags = list(tags)
return tags return tags
def get_taxonomie_enabled_tags(taxonomie, r_list=False): # TODO MOVE ME
res = r_tags.smembers(f'active_tag_{taxonomie}') # TODO MOVE ME
# TODO MOVE ME
# TODO MOVE ME
def get_taxonomie_enabled_tags(taxonomy, r_list=False):
res = get_taxonomy_tags_enabled(taxonomy)
if r_list: if r_list:
return list(res) return list(res)
else: else:
return res return res
# TODO MOVE ME
# TODO MOVE ME
# TODO MOVE ME
# TODO MOVE ME
def get_galaxy_enabled_tags(galaxy, r_list=False): def get_galaxy_enabled_tags(galaxy, r_list=False):
res = r_tags.smembers(f'active_tag_galaxies_{galaxy}') res = get_galaxy_tags_enabled(galaxy)
if r_list: if r_list:
return list(res) return list(res)
else: else:
return res return res
def is_taxonomie_tag_enabled(taxonomie, tag): def is_taxonomie_tag_enabled(taxonomie, tag):
if tag in r_tags.smembers('active_tag_' + taxonomie): if tag in r_tags.smembers('active_tag_' + taxonomie):
return True return True