Skip to content
Snippets Groups Projects

list_comments api call improvements

Merged Dariusz Kędzierski requested to merge dk-list-comments-by-fixes into develop
All threads resolved!
Files
26
+ 17
7
@@ -91,6 +91,7 @@ def build_metadata():
# core stats/indexes
sa.Column('payout', sa.types.DECIMAL(10, 3), nullable=False, server_default='0'),
sa.Column('pending_payout', sa.types.DECIMAL(10, 3), nullable=False, server_default='0'),
sa.Column('payout_at', sa.DateTime, nullable=False, server_default='1990-01-01'),
sa.Column('updated_at', sa.DateTime, nullable=False, server_default='1990-01-01'),
sa.Column('is_paidout', BOOLEAN, nullable=False, server_default='0'),
@@ -117,12 +118,12 @@ def build_metadata():
sa.Column('abs_rshares', sa.BigInteger, nullable=False, server_default='0'),
sa.Column('vote_rshares', sa.BigInteger, nullable=False, server_default='0'),
sa.Column('net_votes', sa.Integer, nullable=False, server_default='0'),
sa.Column('active', sa.DateTime, nullable=False, server_default='1970-01-01 00:00:00'),
sa.Column('active', sa.DateTime, nullable=False, server_default='1970-01-01 00:00:00'), # TODO: the last time this post was "touched" by voting or reply
sa.Column('last_payout', sa.DateTime, nullable=False, server_default='1970-01-01 00:00:00'),
sa.Column('cashout_time', sa.DateTime, nullable=False, server_default='1970-01-01 00:00:00'),
sa.Column('max_cashout_time', sa.DateTime, nullable=False, server_default='1970-01-01 00:00:00'),
sa.Column('percent_hbd', sa.Integer, nullable=False, server_default='10000'),
sa.Column('reward_weight', sa.Integer, nullable=False, server_default='0'),
sa.Column('reward_weight', sa.Integer, nullable=False, server_default='10000'), # Seems to be always 10000
sa.Column('parent_author_id', sa.Integer, nullable=False),
sa.Column('parent_permlink_id', sa.BigInteger, nullable=False),
@@ -451,7 +452,7 @@ def setup(db):
category_id,
root_author_id, root_permlink_id,
is_muted, is_valid,
author_id, permlink_id, created_at, updated_at)
author_id, permlink_id, created_at, updated_at, active)
SELECT php.id AS parent_id, php.author_id as parent_author_id,
php.permlink_id as parent_permlink_id, php.depth + 1 as depth,
(CASE
@@ -464,7 +465,8 @@ def setup(db):
php.root_permlink_id as root_permlink_id,
php.is_muted as is_muted, php.is_valid as is_valid,
ha.id as author_id, hpd.id as permlink_id, _date as created_at,
_date as updated_at
_date as updated_at,
_date as active
FROM hive_accounts ha,
hive_permlink_data hpd,
hive_posts php
@@ -478,6 +480,7 @@ def setup(db):
--- then also depth, is_valid and is_muted is impossible to change
--- post edit part
updated_at = _date,
active = _date,
--- post undelete part (if was deleted)
is_deleted = (CASE hp.is_deleted
@@ -505,7 +508,7 @@ def setup(db):
category_id,
root_author_id, root_permlink_id,
is_muted, is_valid,
author_id, permlink_id, created_at, updated_at)
author_id, permlink_id, created_at, updated_at, active)
SELECT 0 AS parent_id, 0 as parent_author_id, 0 as parent_permlink_id, 0 as depth,
(CASE
WHEN _date > _community_support_start_date THEN
@@ -517,7 +520,8 @@ def setup(db):
hpd.id as root_permlink_id, -- use perlink_id as root one if no parent
false as is_muted, true as is_valid,
ha.id as author_id, hpd.id as permlink_id, _date as created_at,
_date as updated_at
_date as updated_at,
_date as active
FROM hive_accounts ha,
hive_permlink_data hpd
WHERE ha.name = _author and hpd.permlink = _permlink
@@ -527,6 +531,7 @@ def setup(db):
--- then also depth, is_valid and is_muted is impossible to change
--- post edit part
updated_at = _date,
active = _date,
--- post undelete part (if was deleted)
is_deleted = (CASE hp.is_deleted
@@ -580,6 +585,8 @@ def setup(db):
hp.community_id,
hp.parent_id,
ha_a.name AS author,
hp.active,
hp.author_rewards,
hp.author_id,
hpd_p.permlink,
hpd.title,
@@ -639,7 +646,10 @@ def setup(db):
hr.title AS role_title,
hr.role_id AS role_id,
hc.title AS community_title,
hc.name AS community_name
hc.name AS community_name,
hp.abs_rshares,
hp.max_cashout_time,
hp.reward_weight
FROM hive_posts hp
JOIN hive_posts rp ON rp.author_id = hp.root_author_id AND rp.permlink_id = hp.root_permlink_id
JOIN hive_post_data rpd ON rp.id = rpd.id
Loading