Skip to content
Snippets Groups Projects
Commit efc6af50 authored by Mariusz Trela's avatar Mariusz Trela Committed by Mariusz Trela
Browse files

New tests + fix in `condenser_get_by_replies_to_account` SQL method

parent 13868a13
No related branches found
No related tags found
2 merge requests!456Release candidate v1 24,!368New tests
......@@ -10,20 +10,27 @@ AS
$function$
DECLARE
__post_id INTEGER := 0;
__parent_author_id INTEGER := 0;
BEGIN
IF _permlink <> '' THEN
__post_id = find_comment_id( _author, _permlink, True );
SELECT
ha_pp.name, hp.id
pp.author_id
INTO
_author, __post_id
__parent_author_id
FROM hive_posts hp
JOIN hive_posts pp ON hp.parent_id = pp.id
JOIN hive_accounts ha_pp ON ha_pp.id = pp.author_id
JOIN hive_permlink_data hpd_pp ON hpd_pp.id = pp.permlink_id
JOIN hive_accounts ha ON hp.author_id = ha.id
WHERE
hpd_pp.permlink = _permlink AND ha.name = _author;
WHERE hp.id = __post_id;
ELSE
SELECT
id
INTO
__parent_author_id
FROM hive_accounts
WHERE name = _author;
END IF;
RETURN QUERY SELECT
......@@ -64,15 +71,8 @@ BEGIN
hp.is_pinned,
hp.curator_payout_value
FROM hive_posts_view hp
JOIN
(
SELECT hp.id
FROM hive_posts_view hp
WHERE hp.author = _author
ORDER BY hp.id DESC
LIMIT _limit
) T ON hp.parent_id = T.id
WHERE ( ( __post_id = 0 ) OR ( hp.id <= __post_id ) )
JOIN hive_posts pp ON hp.parent_id = pp.id
WHERE pp.author_id = __parent_author_id AND ( ( __post_id = 0 ) OR ( hp.id <= __post_id ) )
ORDER BY hp.id DESC
LIMIT _limit;
......
Subproject commit 640732ad7ed82afe9da93183e62b71f7f67b2bd9
Subproject commit fba171b01622cae77e8b6d9f7f5be3c14f920924
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment