Some draft revisions can exist multiple times in the crawl history? Filter them.

- Legacy-Id: 10604
This commit is contained in:
Lars Eggert 2015-12-16 15:42:11 +00:00
parent cf4964059f
commit 3763c4980c

View file

@ -577,4 +577,11 @@ def crawl_history(doc):
'published': e.time.isoformat(),
'url': urlreverse("doc_view", kwargs=dict(name=e.doc))
})
return sorted(retval, key=lambda x: x['published'])
# for some reason, some draft revisions can exist multiple times?
seen = set()
unique = []
for r in retval:
if r["url"] not in seen:
unique.append(r)
seen.add(r["url"])
return sorted(unique, key=lambda x: x['published'])