last-comment-fix
All checks were successful
Deploy on push / deploy (push) Successful in 23s

This commit is contained in:
Untone 2024-03-25 19:50:23 +03:00
parent d92d280595
commit 337fa82fb4
2 changed files with 7 additions and 3 deletions

View File

@ -57,7 +57,7 @@ async def get_shout(_, info, slug: str):
commented_stat, commented_stat,
likes_stat, likes_stat,
dislikes_stat, dislikes_stat,
_last_comment, last_comment,
] = results ] = results
shout.stat = { shout.stat = {
@ -65,6 +65,7 @@ async def get_shout(_, info, slug: str):
'reacted': reacted_stat, 'reacted': reacted_stat,
'commented': commented_stat, 'commented': commented_stat,
'rating': int(likes_stat or 0) - int(dislikes_stat or 0), 'rating': int(likes_stat or 0) - int(dislikes_stat or 0),
'last_comment': last_comment
} }
for author_caption in ( for author_caption in (
@ -161,7 +162,7 @@ async def load_shouts_by(_, _info, options):
commented_stat, commented_stat,
likes_stat, likes_stat,
dislikes_stat, dislikes_stat,
_last_comment, last_comment,
] in session.execute(q).unique(): ] in session.execute(q).unique():
main_topic = ( main_topic = (
session.query(Topic.slug) session.query(Topic.slug)
@ -183,6 +184,7 @@ async def load_shouts_by(_, _info, options):
'reacted': reacted_stat, 'reacted': reacted_stat,
'commented': commented_stat, 'commented': commented_stat,
'rating': int(likes_stat) - int(dislikes_stat), 'rating': int(likes_stat) - int(dislikes_stat),
'last_comment': last_comment
} }
shouts.append(shout) shouts.append(shout)
@ -258,7 +260,7 @@ async def load_shouts_feed(_, info, options):
commented_stat, commented_stat,
likes_stat, likes_stat,
dislikes_stat, dislikes_stat,
_last_comment, last_comment,
] in session.execute(q).unique(): ] in session.execute(q).unique():
main_topic = ( main_topic = (
session.query(Topic.slug) session.query(Topic.slug)
@ -280,6 +282,7 @@ async def load_shouts_feed(_, info, options):
'reacted': reacted_stat, 'reacted': reacted_stat,
'commented': commented_stat, 'commented': commented_stat,
'rating': likes_stat - dislikes_stat, 'rating': likes_stat - dislikes_stat,
'last_comment': last_comment
} }
shouts.append(shout) shouts.append(shout)

View File

@ -96,6 +96,7 @@ type Stat {
rating: Int rating: Int
commented: Int commented: Int
ranking: Int ranking: Int
last_comment: Int
} }
type Community { type Community {