get_topics_all no page and size
This commit is contained in:
parent
114b2d8b0f
commit
68096b21a4
|
@ -11,8 +11,8 @@ import random
|
||||||
|
|
||||||
|
|
||||||
@query.field("topicsAll")
|
@query.field("topicsAll")
|
||||||
async def topics_all(_, info, page=1, size=50):
|
async def topics_all(_, info):
|
||||||
topics = await TopicStorage.get_topics_all(page, size)
|
topics = await TopicStorage.get_topics_all()
|
||||||
for topic in topics:
|
for topic in topics:
|
||||||
topic.stat = await TopicStat.get_stat(topic.slug)
|
topic.stat = await TopicStat.get_stat(topic.slug)
|
||||||
return topics
|
return topics
|
||||||
|
@ -86,7 +86,7 @@ def topic_unfollow(user, slug):
|
||||||
|
|
||||||
@query.field("topicsRandom")
|
@query.field("topicsRandom")
|
||||||
async def topics_random(_, info):
|
async def topics_random(_, info):
|
||||||
topics = await TopicStorage.get_topics_all(1, 700)
|
topics = await TopicStorage.get_topics_all()
|
||||||
normalized_topics = []
|
normalized_topics = []
|
||||||
for topic in topics:
|
for topic in topics:
|
||||||
topic_stat = await TopicStat.get_stat(topic.slug)
|
topic_stat = await TopicStat.get_stat(topic.slug)
|
||||||
|
|
|
@ -27,12 +27,10 @@ class TopicStorage:
|
||||||
return topic
|
return topic
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
async def get_topics_all(page, size):
|
async def get_topics_all():
|
||||||
end = page * size
|
|
||||||
start = end - size
|
|
||||||
self = TopicStorage
|
self = TopicStorage
|
||||||
async with self.lock:
|
async with self.lock:
|
||||||
return list(self.topics.values())[start:end]
|
return list(self.topics.values())
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
async def get_topics_by_slugs(slugs):
|
async def get_topics_by_slugs(slugs):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user