WIP
This commit is contained in:
@@ -7,7 +7,6 @@ from base.resolvers import query
|
||||
from orm import ViewedEntry
|
||||
from orm.shout import Shout, ShoutAuthor
|
||||
from orm.reaction import Reaction, ReactionKind
|
||||
from services.stat.reacted import ReactedStorage
|
||||
|
||||
|
||||
def add_rating_column(q):
|
||||
@@ -135,17 +134,15 @@ async def load_shouts_by(_, info, options):
|
||||
q = q.group_by(Shout.id).order_by(query_order_by).limit(limit).offset(offset)
|
||||
|
||||
with local_session() as session:
|
||||
shouts = list(map(map_result_item, session.execute(q).unique()))
|
||||
|
||||
for shout in shouts:
|
||||
shout.stat = await ReactedStorage.get_shout_stat(shout.slug, shout.rating)
|
||||
del shout.rating
|
||||
results = session.execute(q).unique()
|
||||
for [shout, rating] in results:
|
||||
shout.stat = await ReactedStorage.get_shout_stat(shout.slug, rating)
|
||||
|
||||
author_captions = {}
|
||||
|
||||
if with_author_captions:
|
||||
author_captions_result = session.query(ShoutAuthor).where(
|
||||
ShoutAuthor.shout.in_(map(lambda s: s.slug, shouts))).all()
|
||||
ShoutAuthor.shout.in_(map(lambda result_item: result_item[0].slug, results))).all()
|
||||
|
||||
for author_captions_result_item in author_captions_result:
|
||||
if author_captions.get(author_captions_result_item.shout) is None:
|
||||
|
@@ -10,8 +10,6 @@ from orm.reaction import Reaction
|
||||
from orm.shout import ShoutAuthor
|
||||
from orm.topic import Topic, TopicFollower
|
||||
from orm.user import AuthorFollower, Role, User, UserRating, UserRole
|
||||
from services.stat.reacted import ReactedStorage
|
||||
from services.stat.topicstat import TopicStat
|
||||
|
||||
# from .community import followed_communities
|
||||
from resolvers.inbox.unread import get_total_unread_counter
|
||||
|
@@ -8,7 +8,6 @@ from base.resolvers import mutation, query
|
||||
from orm.reaction import Reaction, ReactionKind
|
||||
from orm.shout import Shout, ShoutReactionsFollower
|
||||
from orm.user import User
|
||||
from services.stat.reacted import ReactedStorage
|
||||
|
||||
|
||||
async def get_reaction_stat(reaction_id):
|
||||
|
@@ -5,9 +5,7 @@ from base.orm import local_session
|
||||
from base.resolvers import mutation, query
|
||||
from orm import Shout
|
||||
from orm.topic import Topic, TopicFollower
|
||||
from services.zine.topics import TopicStorage
|
||||
# from services.stat.reacted import ReactedStorage
|
||||
from services.stat.topicstat import TopicStat
|
||||
|
||||
|
||||
# from services.stat.viewed import ViewedStorage
|
||||
|
Reference in New Issue
Block a user