From 93e5c3418788b33d2bd77c22631fbd32293d72be Mon Sep 17 00:00:00 2001 From: ABW <andrzejl@syncad.com> Date: Thu, 20 Aug 2020 15:53:20 +0200 Subject: [PATCH] [ABW]: [Fix] run_tests.sh didn't work from main hivemind folder [Fix] no == operator in SQL [Ign] renamed inefficient_deleted_ops to ineffective_deleted_ops --- hive/db/schema.py | 2 +- hive/indexer/blocks.py | 16 ++++++++-------- hive/indexer/votes.py | 2 +- hive/server/condenser_api/objects.py | 2 +- hive/version.py | 8 ++++---- scripts/run_tests.sh | 2 +- tests/tests_api | 2 +- 7 files changed, 17 insertions(+), 17 deletions(-) diff --git a/hive/db/schema.py b/hive/db/schema.py index fae5bba18..8a698c14e 100644 --- a/hive/db/schema.py +++ b/hive/db/schema.py @@ -832,7 +832,7 @@ def setup(db): hive_posts_view hp WHERE NOT hp.is_muted AND - hp.counter_deleted == 0 AND + hp.counter_deleted = 0 AND hp.cashout_time > _cashout_time OR hp.cashout_time = _cashout_time AND hp.id >= __post_id ORDER BY diff --git a/hive/indexer/blocks.py b/hive/indexer/blocks.py index 8c0e26d82..cf5e085ae 100644 --- a/hive/indexer/blocks.py +++ b/hive/indexer/blocks.py @@ -105,7 +105,7 @@ class Blocks: def prepare_vops(comment_payout_ops, vopsList, date, block_num): vote_ops = {} - inefficient_deleted_ops = {} + ineffective_deleted_ops = {} registered_ops_stats = [ 'author_reward_operation', 'comment_reward_operation', 'effective_comment_vote_operation', 'comment_payout_update_operation', 'ineffective_delete_comment_operation'] for vop in vopsList: @@ -147,12 +147,12 @@ class Blocks: comment_payout_ops[key][op_type] = op_value elif op_type == 'ineffective_delete_comment_operation': - inefficient_deleted_ops[key] = {} + ineffective_deleted_ops[key] = {} if op_type in registered_ops_stats: OPSM.op_stats(op_type, OPSM.stop(start)) - return (vote_ops, inefficient_deleted_ops) + return (vote_ops, ineffective_deleted_ops) @classmethod @@ -172,14 +172,14 @@ class Blocks: vote_ops = None comment_payout_stats = None - inefficient_deleted_ops = None + ineffective_deleted_ops = None if is_initial_sync: if num in virtual_operations: - (vote_ops, inefficient_deleted_ops ) = Blocks.prepare_vops(Posts.comment_payout_ops, virtual_operations[num], cls._current_block_date, num) + (vote_ops, ineffective_deleted_ops ) = Blocks.prepare_vops(Posts.comment_payout_ops, virtual_operations[num], cls._current_block_date, num) else: vops = hived.get_virtual_operations(num) - (vote_ops, inefficient_deleted_ops ) = Blocks.prepare_vops(Posts.comment_payout_ops, vops, cls._current_block_date, num) + (vote_ops, ineffective_deleted_ops ) = Blocks.prepare_vops(Posts.comment_payout_ops, vops, cls._current_block_date, num) json_ops = [] for tx_idx, tx in enumerate(block['transactions']): @@ -221,8 +221,8 @@ class Blocks: Accounts.dirty(op['author']) # lite - stats elif op_type == 'delete_comment_operation': key = "{}/{}".format(op['author'], op['permlink']) - if ( inefficient_deleted_ops is None ) or ( key not in inefficient_deleted_ops ): - Posts.delete_op(op) + if ( ineffective_deleted_ops is None ) or ( key not in ineffective_deleted_ops ): + Posts.delete_op(op) elif op_type == 'comment_options_operation': Posts.comment_options_op(op) elif op_type == 'vote_operation': diff --git a/hive/indexer/votes.py b/hive/indexer/votes.py index 60b7605c5..e01006c72 100644 --- a/hive/indexer/votes.py +++ b/hive/indexer/votes.py @@ -58,7 +58,7 @@ class Votes: cls._votes_data[key]["weight"] = vop["weight"] cls._votes_data[key]["rshares"] = vop["rshares"] cls._votes_data[key]["is_effective"] = True - cls._votes_data[key]["block_num"] = vop['block_num'] + cls._votes_data[key]["block_num"] = vop['block_num'] @classmethod def flush(cls): diff --git a/hive/server/condenser_api/objects.py b/hive/server/condenser_api/objects.py index a238d01ae..f4218a8a0 100644 --- a/hive/server/condenser_api/objects.py +++ b/hive/server/condenser_api/objects.py @@ -123,7 +123,7 @@ async def load_posts(db, ids, truncate_body=0): hive_posts hp INNER JOIN hive_accounts ha_a ON ha_a.id = hp.author_id INNER JOIN hive_permlink_data hpd_p ON hpd_p.id = hp.permlink_id - WHERE id = :id and counter_deleted = 0 """ + WHERE id = :id AND counter_deleted = 0 """ post = await db.query_row(sql, id=_id) if post is None: # TODO: This should never happen. See #173 for analysis diff --git a/hive/version.py b/hive/version.py index 6852bae9b..1edcc95f0 100644 --- a/hive/version.py +++ b/hive/version.py @@ -1,4 +1,4 @@ -# generated by setup.py -# contents will be overwritten -VERSION = '0.0.1' -GIT_REVISION = 'eb4b61d' +# generated by setup.py +# contents will be overwritten +VERSION = '0.0.1' +GIT_REVISION = '10bc3ad' \ No newline at end of file diff --git a/scripts/run_tests.sh b/scripts/run_tests.sh index 729d33d64..0bf8a31e0 100755 --- a/scripts/run_tests.sh +++ b/scripts/run_tests.sh @@ -55,7 +55,7 @@ fi check_address $1 check_port $2 -cd .. +#cd .. set -e diff --git a/tests/tests_api b/tests/tests_api index d23060b52..04009d68c 160000 --- a/tests/tests_api +++ b/tests/tests_api @@ -1 +1 @@ -Subproject commit d23060b52e4e773308f7bafa666bef231c0e49ed +Subproject commit 04009d68c33226476061412f59f8000dfb4b462f -- GitLab