Skip to content
Snippets Groups Projects

issue #89: net_votes and total_votes are calculated during sync

Merged issue #89: net_votes and total_votes are calculated during sync
Merged Marcin requested to merge mi_issue_89_total_votes into develop
3 files
+ 19
18
Compare changes
  • Side-by-side
  • Inline
Files
3
  • bd5efd5c
    issue #89: net_votes and total_votes are calculated during sync · bd5efd5c
    Marcin authored
@@ -32,22 +32,8 @@ SELECT hp.id,
hp.updated_at,
hp.vote_rshares AS rshares,
hp.abs_rshares AS abs_rshares,
COALESCE(
(
SELECT COUNT( 1 )
FROM hive_votes v
WHERE v.post_id = hp.id AND v.is_effective
GROUP BY v.post_id
), 0
) AS total_votes,
COALESCE(
(
SELECT SUM( CASE v.rshares > 0 WHEN True THEN 1 ELSE -1 END )
FROM hive_votes v
WHERE v.post_id = hp.id AND NOT v.rshares = 0
GROUP BY v.post_id
), 0
) AS net_votes,
hp.total_votes AS total_votes,
hp.net_votes as net_votes,
hpd.json,
ha_a.reputation AS author_rep,
hp.is_hidden,
Loading