return if no in progress videos

This commit is contained in:
simon 2022-02-24 21:25:12 +07:00
parent df777104af
commit 806448624d
No known key found for this signature in database
GPG Key ID: 2C15AA5E89985DD4

View File

@ -172,6 +172,9 @@ class ArchivistResultsView(ArchivistViewConfig):
def match_progress(self): def match_progress(self):
"""add video progress to result context""" """add video progress to result context"""
results = RedisArchivist().list_items(f"{self.user_id}:progress:") results = RedisArchivist().list_items(f"{self.user_id}:progress:")
if not results:
return
progress = {i["youtube_id"]: i["position"] for i in results} progress = {i["youtube_id"]: i["position"] for i in results}
for hit in self.context["results"]: for hit in self.context["results"]:
video = hit["source"] video = hit["source"]