topPublished

This commit is contained in:
2022-09-20 16:32:04 +03:00
parent e41856dbc3
commit c292d7da55
3 changed files with 19 additions and 3 deletions

View File

@@ -248,6 +248,15 @@ class ShoutsCache:
print("[zine.cache] indexed by %d authors " % len(shouts_by_author.keys()))
ShoutsCache.by_author = shouts_by_author
@staticmethod
async def get_top_published_before(daysago, offset, limit):
shouts_by_rating = []
before = datetime.now() - timedelta(days=daysago)
for s in ShoutsCache.recent_published:
if s.publishedAt >= before:
shouts_by_rating.append(s)
return shouts_by_rating
@staticmethod
async def prepare_by_topic():
shouts_by_topic = {}