From 9ed29a961e0f27a891502e0b35f021df0e020a7c Mon Sep 17 00:00:00 2001
From: ABW <andrzejl@syncad.com>
Date: Wed, 29 Jul 2020 17:44:37 +0200
Subject: [PATCH] [ABW]: [Fix] net_rshares collected dynamically from votes on
 call [Fix] condenser_api::get_content_replies uses short active_votes form

---
 hive/db/schema.py                    | 2 +-
 hive/server/condenser_api/objects.py | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/hive/db/schema.py b/hive/db/schema.py
index 1c47c4b6b..35eb76a4b 100644
--- a/hive/db/schema.py
+++ b/hive/db/schema.py
@@ -608,7 +608,7 @@ def setup(db):
             0 AS active_votes,
             hp.created_at,
             hp.updated_at,
-            hp.rshares,
+            (SELECT SUM( v.rshares ) FROM hive_votes v WHERE v.post_id = hp.id GROUP BY v.post_id) AS rshares,
             hpd.json,
             ha_a.reputation AS author_rep,
             hp.is_hidden,
diff --git a/hive/server/condenser_api/objects.py b/hive/server/condenser_api/objects.py
index efe6486c1..661a7784c 100644
--- a/hive/server/condenser_api/objects.py
+++ b/hive/server/condenser_api/objects.py
@@ -141,7 +141,7 @@ async def resultset_to_posts(db, resultset, truncate_body=0):
         row = dict(row)
         row['author_rep'] = author_reps[row['author']]
         post = _condenser_post_object(row, truncate_body=truncate_body)
-        post['active_votes'] = await find_votes({'db':db}, {'author':row['author'], 'permlink':row['permlink']})
+        post['active_votes'] = await find_votes({'db':db}, {'author':row['author'], 'permlink':row['permlink']}, VotesPresentation.CondenserApi)
         posts.append(post)
 
     return posts
-- 
GitLab