unique-fix

This commit is contained in:
tonyrewin 2022-10-01 14:16:04 +03:00
parent 7ee8003e2d
commit 45a827de64

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 a not in ShoutsCache.by_topic[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 t 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