diff --git a/hive/db/schema.py b/hive/db/schema.py index 63bc696d43a9db567f62dc0e87888a089bf070f4..b0b3172e00a82cdb5433808f2be0eda862414862 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 efe6486c150408fb3fec302eebb3bd9927cd6dc6..661a7784ca3d3228f951d43b382c1cb78667f770 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