This commit is contained in:
parent
d37f68869c
commit
b992a73698
|
@ -100,7 +100,7 @@ async def get_shout(_, _info, slug=None, shout_id=None):
|
|||
for author in shout.authors:
|
||||
if author.id == author_caption.author:
|
||||
author.caption = author_caption.caption
|
||||
shout.main_topic = session.query(Topic.slug).join(ShoutTopic, and_(ShoutTopic.topic == Topic.id, ShoutTopic.shout == shout.id, ShoutTopic.main == True)).first()
|
||||
shout.main_topic = session.query(Topic.slug).join(ShoutTopic, and_(ShoutTopic.topic == Topic.id, ShoutTopic.shout == shout.id, ShoutTopic.main == True)).first().pop()
|
||||
return shout
|
||||
except Exception:
|
||||
raise HTTPException(status_code=404, detail=f"shout {slug or shout_id} not found")
|
||||
|
@ -159,7 +159,7 @@ async def load_shouts_by(_, _info, options):
|
|||
shouts = []
|
||||
with local_session() as session:
|
||||
for [shout, reacted_stat, commented_stat, rating_stat, _last_comment] in session.execute(q).unique():
|
||||
shout.main_topic = session.query(Topic.slug).join(ShoutTopic, and_(ShoutTopic.topic == Topic.id, ShoutTopic.shout == shout.id, ShoutTopic.main == True)).first()
|
||||
shout.main_topic = session.query(Topic.slug).join(ShoutTopic, and_(ShoutTopic.topic == Topic.id, ShoutTopic.shout == shout.id, ShoutTopic.main == True)).first().pop()
|
||||
shout.stat = {
|
||||
"viewed": await ViewedStorage.get_shout(shout.slug),
|
||||
"reacted": reacted_stat,
|
||||
|
@ -196,7 +196,7 @@ async def load_shouts_drafts(_, info):
|
|||
shout.main_topic = session.query(ShoutTopics.topic_slug).filter(
|
||||
ShoutTopics.shout_id == shout.id,
|
||||
ShoutTopics.main == True
|
||||
).first()
|
||||
).first().pop()
|
||||
shouts.append(shout)
|
||||
|
||||
return shouts
|
||||
|
@ -249,7 +249,7 @@ async def load_shouts_feed(_, info, options):
|
|||
|
||||
shouts = []
|
||||
for [shout, reacted_stat, commented_stat, rating_stat, _last_comment] in session.execute(q).unique():
|
||||
shout.main_topic = session.query(Topic.slug).join(ShoutTopic, and_(ShoutTopic.topic == Topic.id, ShoutTopic.shout == shout.id, ShoutTopic.main == True)).first()
|
||||
shout.main_topic = session.query(Topic.slug).join(ShoutTopic, and_(ShoutTopic.topic == Topic.id, ShoutTopic.shout == shout.id, ShoutTopic.main == True)).first().pop()
|
||||
shout.stat = {
|
||||
"viewed": await ViewedStorage.get_shout(shout.slug),
|
||||
"reacted": reacted_stat,
|
||||
|
|
Loading…
Reference in New Issue
Block a user