From c053fe8a6d8969e719728098c2673298bfe2308b Mon Sep 17 00:00:00 2001 From: benni043 Date: Thu, 24 Sep 2026 22:47:23 +0200 Subject: [PATCH] fixed category count --- app/components/Filter/CategorySelect.vue | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/app/components/Filter/CategorySelect.vue b/app/components/Filter/CategorySelect.vue index 31ffb3b..01ac71d 100644 --- a/app/components/Filter/CategorySelect.vue +++ b/app/components/Filter/CategorySelect.vue @@ -13,6 +13,8 @@ const { isMobile } = useDevice(); const { shift } = useMagicKeys(); + const { tags } = useFilter(); + function onPress(category: UUID, alwaysAdd: boolean) { if (activeCategorys.value.includes(category)) { activeCategorys.value = activeCategorys.value.filter( @@ -37,7 +39,20 @@ (todos.value ?? []).forEach((todo) => { if (!todo.category) return; - map.set(todo.category.uuid, (map.get(todo.category.uuid) ?? 0) + 1); + + if (tags.value.length === 0) { + map.set(todo.category.uuid, (map.get(todo.category.uuid) ?? 0) + 1); + return; + } + + const todoTagUuids = (todo.tags ?? []).map((t) => t.uuid); + const hasAllTags = tags.value.every((activeTag) => + todoTagUuids.includes(activeTag), + ); + + if (hasAllTags) { + map.set(todo.category.uuid, (map.get(todo.category.uuid) ?? 0) + 1); + } }); return map; -- 2.51.2