fix-authors
This commit is contained in:
parent
ee26388752
commit
ece6a3410c
|
@ -197,11 +197,13 @@ def author_unfollow(user, slug):
|
||||||
|
|
||||||
@query.field("authorsAll")
|
@query.field("authorsAll")
|
||||||
async def get_authors_all(_, _info):
|
async def get_authors_all(_, _info):
|
||||||
authors = await UserStorage.get_all_users()
|
users = await UserStorage.get_all_users()
|
||||||
authorslugs = ShoutsCache.by_author.keys()
|
authorslugs = await ShoutsCache.get_all_authors_slugs()
|
||||||
authors = filter(lambda a: a.emailConfirmed and a.slug in authorslugs, authors)
|
authors = []
|
||||||
for author in authors:
|
for author in users:
|
||||||
|
if author.slug in authorslugs:
|
||||||
author.stat = await get_author_stat(author.slug)
|
author.stat = await get_author_stat(author.slug)
|
||||||
|
authors.append(author)
|
||||||
return authors
|
return authors
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -251,6 +251,11 @@ class ShoutsCache:
|
||||||
shouts_by_rating.sort(lambda s: s.stat["rating"], reverse=True)
|
shouts_by_rating.sort(lambda s: s.stat["rating"], reverse=True)
|
||||||
return shouts_by_rating
|
return shouts_by_rating
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
async def get_all_authors_slugs():
|
||||||
|
slugs = ShoutsCache.by_author.keys()
|
||||||
|
return slugs
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
async def worker():
|
async def worker():
|
||||||
while True:
|
while True:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user