From 337fa82fb4c9d38564b2a3122f5f8b7868ed8d86 Mon Sep 17 00:00:00 2001 From: Untone Date: Mon, 25 Mar 2024 19:50:23 +0300 Subject: [PATCH] last-comment-fix --- resolvers/reader.py | 9 ++++++--- schema/type.graphql | 1 + 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/resolvers/reader.py b/resolvers/reader.py index a0e02cfe..bf9c4afe 100644 --- a/resolvers/reader.py +++ b/resolvers/reader.py @@ -57,7 +57,7 @@ async def get_shout(_, info, slug: str): commented_stat, likes_stat, dislikes_stat, - _last_comment, + last_comment, ] = results shout.stat = { @@ -65,6 +65,7 @@ async def get_shout(_, info, slug: str): 'reacted': reacted_stat, 'commented': commented_stat, 'rating': int(likes_stat or 0) - int(dislikes_stat or 0), + 'last_comment': last_comment } for author_caption in ( @@ -161,7 +162,7 @@ async def load_shouts_by(_, _info, options): commented_stat, likes_stat, dislikes_stat, - _last_comment, + last_comment, ] in session.execute(q).unique(): main_topic = ( session.query(Topic.slug) @@ -183,6 +184,7 @@ async def load_shouts_by(_, _info, options): 'reacted': reacted_stat, 'commented': commented_stat, 'rating': int(likes_stat) - int(dislikes_stat), + 'last_comment': last_comment } shouts.append(shout) @@ -258,7 +260,7 @@ async def load_shouts_feed(_, info, options): commented_stat, likes_stat, dislikes_stat, - _last_comment, + last_comment, ] in session.execute(q).unique(): main_topic = ( session.query(Topic.slug) @@ -280,6 +282,7 @@ async def load_shouts_feed(_, info, options): 'reacted': reacted_stat, 'commented': commented_stat, 'rating': likes_stat - dislikes_stat, + 'last_comment': last_comment } shouts.append(shout) diff --git a/schema/type.graphql b/schema/type.graphql index 62857763..f51cabb6 100644 --- a/schema/type.graphql +++ b/schema/type.graphql @@ -96,6 +96,7 @@ type Stat { rating: Int commented: Int ranking: Int + last_comment: Int } type Community {