fix library collections: remove duplicates, correct counts
Some checks failed
ci/woodpecker/push/deploy Pipeline failed
ci/woodpecker/push/infra-ci Pipeline was successful
coverage 99% coverage
ci/woodpecker/push/ci Pipeline was successful

- Delete 2 empty duplicate "Supplemental" collections from bib.sqlite
  (ERRVP346 and JK6N2CLM — 0 items each, leftover from Zotero sync)
- Fix export: item_count now shows direct items only (matches what the
  filter actually returns), not misleading recursive totals
- Drop collections with 0 direct items from export (they produce empty
  results when clicked)

Before: 19 collections, 3x "Supplemental", PFS showing 12429
After:  8 collections, 1x "Supplemental", PFS showing 254
This commit is contained in:
kert
2026-03-21 16:43:13 -04:00
parent 2c79dfc89f
commit 9ab78d58c0
2 changed files with 6 additions and 1 deletions

Binary file not shown.

View File

@@ -42,9 +42,14 @@ def main() -> None:
store = Store(str(BIB_DB))
items = store.list_items()
collections = store.list_collections()
raw_collections = store.list_collections()
tags = store.list_tags()
# item_count from list_collections() is direct-only, which is what
# the library page filter uses (i.collections.includes(key)).
# Drop collections with 0 direct items — they produce empty results.
collections = [c for c in raw_collections if c["item_count"] > 0]
serialized_items = []
for item in items:
abstract = item.abstract or ""