unique-fix

This commit is contained in:
2022-10-05 14:54:04 +03:00
parent c10f416567
commit 037c111b1d
2 changed files with 23 additions and 24 deletions

View File

@@ -66,10 +66,12 @@ class ShoutsCache:
for s in shouts:
for a in s.authors:
ShoutsCache.by_author[a.slug] = ShoutsCache.by_author.get(a.slug, [])
ShoutsCache.by_author[a.slug].append(s)
if s not in ShoutsCache.by_author[a.slug]:
ShoutsCache.by_author[a.slug].append(s)
for t in s.topics:
ShoutsCache.by_topic[t.slug] = ShoutsCache.by_topic.get(t.slug, [])
ShoutsCache.by_topic[t.slug].append(s)
if s not in ShoutsCache.by_topic[t.slug]:
ShoutsCache.by_topic[t.slug].append(s)
print("[zine.cache] indexed by %d topics " % len(ShoutsCache.by_topic.keys()))
print("[zine.cache] indexed by %d authors " % len(ShoutsCache.by_author.keys()))
ShoutsCache.recent_published = shouts