From 45a827de64a0417ebdc40d4072f3393a5fb5a004 Mon Sep 17 00:00:00 2001 From: tonyrewin Date: Sat, 1 Oct 2022 14:16:04 +0300 Subject: [PATCH] unique-fix --- services/zine/shoutscache.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/services/zine/shoutscache.py b/services/zine/shoutscache.py index c39823b1..3aeae32f 100644 --- a/services/zine/shoutscache.py +++ b/services/zine/shoutscache.py @@ -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