Commit 98eaf112 authored by Bartek Wrona's avatar Bartek Wrona

Merge branch 'reputation_update_fix' into 'develop'

Fixes related to reputations update during regular sync.

See merge request !206
parents 6cceb532 b79bcba0
......@@ -124,7 +124,9 @@ class DbState:
'hive_post_tags_tag_id_idx',
'hive_votes_voter_id_post_id_idx',
'hive_votes_post_id_voter_id_idx'
'hive_votes_post_id_voter_id_idx',
'hive_reputation_data_block_num_idx'
]
to_return = []
......
......@@ -70,7 +70,8 @@ def build_metadata():
sa.Column('rshares', sa.BigInteger, nullable=False),
sa.Column('block_num', sa.Integer, nullable=False),
sa.Index('hive_reputation_data_author_permlink_voter_idx', 'author_id', 'permlink', 'voter_id')
sa.Index('hive_reputation_data_author_permlink_voter_idx', 'author_id', 'permlink', 'voter_id'),
sa.Index('hive_reputation_data_block_num_idx', 'block_num')
)
sa.Table(
......
......@@ -5,12 +5,15 @@ CREATE TYPE AccountReputation AS (id int, reputation bigint, is_implicit boolean
DROP FUNCTION IF EXISTS public.calculate_account_reputations;
CREATE OR REPLACE FUNCTION public.calculate_account_reputations(
in _first_block_num INTEGER,
in _last_block_num INTEGER,
in _tracked_account varchar = null)
_first_block_num integer,
_last_block_num integer,
_tracked_account character varying DEFAULT NULL::character varying)
RETURNS SETOF accountreputation
LANGUAGE 'plpgsql'
STABLE
COST 100
STABLE
ROWS 1000
AS $BODY$
DECLARE
__vote_data RECORD;
......@@ -97,9 +100,12 @@ BEGIN
RETURN QUERY
SELECT id, Reputation, is_implicit
FROM unnest(__account_reputations);
FROM unnest(__account_reputations)
WHERE Reputation IS NOT NULL
;
END
$BODY$;
$BODY$
;
DROP FUNCTION IF EXISTS public.update_account_reputations;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment