Skip to content
Snippets Groups Projects
Commit 148d9c28 authored by Andrzej Lisak's avatar Andrzej Lisak
Browse files

[ABW]: list_comments with by_root, by_parent, by_last_update and...

[ABW]: list_comments with by_root, by_parent, by_last_update and by_author_last_update have their main parameters required (nonempty)
list_comments_by_cashout_time requires valid start post when not completely skipped
[Fix] list_comments_by_cashout_time and list_comments_by_permlink would in some cases select special null post in inner query giving one post below limit
[Fix] list_comments_by_last_update incorrectly used found parent author id (matching it with post id)
tests rebound to proper version (above and earlier changes required a lot of changes in database api tests)
parent 1a143962
No related branches found
No related tags found
3 merge requests!456Release candidate v1 24,!230Setup monitoring with pghero,!169Changes to list_comments proposed by Andrzej L.
......@@ -214,16 +214,6 @@ condenser_api_smoketest_negative:
reports:
junit: api_smoketest_condenser_api_negative.xml
database_api_smoketest_old:
<<: *common_api_smoketest_job
script:
- scripts/ci_start_api_smoketest.sh localhost "$HIVEMIND_HTTP_PORT" test_database_api_patterns.tavern.yaml api_smoketest_database_api_old.xml
artifacts:
reports:
junit: api_smoketest_database_api_old.xml
database_api_smoketest:
<<: *common_api_smoketest_job
......@@ -244,25 +234,25 @@ database_api_smoketest_negative:
reports:
junit: api_smoketest_database_api_negative.xml
follow_api_smoketest_old:
follow_api_smoketest:
<<: *common_api_smoketest_job
script:
- scripts/ci_start_api_smoketest.sh localhost "$HIVEMIND_HTTP_PORT" test_follow_api_patterns.tavern.yaml api_smoketest_follow_api_old.xml
- scripts/ci_start_api_smoketest.sh localhost "$HIVEMIND_HTTP_PORT" follow_api_patterns/ api_smoketest_follow_api.xml
artifacts:
reports:
junit: api_smoketest_follow_api_old.xml
junit: api_smoketest_follow_api.xml
follow_api_smoketest:
follow_api_smoketest_negative:
<<: *common_api_smoketest_job
script:
- scripts/ci_start_api_smoketest.sh localhost "$HIVEMIND_HTTP_PORT" follow_api_patterns/ api_smoketest_follow_api.xml
- scripts/ci_start_api_smoketest.sh localhost "$HIVEMIND_HTTP_PORT" follow_api_negative/ api_smoketest_follow_api_negative.xml
artifacts:
reports:
junit: api_smoketest_follow_api.xml
junit: api_smoketest_follow_api_negative.xml
tags_api_smoketest:
<<: *common_api_smoketest_job
......
......@@ -993,7 +993,7 @@ def setup(db):
BEGIN
_VOTER_ID = find_account_id( _VOTER, _VOTER != '' );
_POST_ID = find_comment_id( _AUTHOR, _PERMLINK, _AUTHOR != '' OR _PERMLINK != '' );
_POST_ID = find_comment_id( _AUTHOR, _PERMLINK, True );
RETURN QUERY
(
......@@ -1041,7 +1041,7 @@ def setup(db):
BEGIN
_VOTER_ID = find_account_id( _VOTER, _VOTER != '' );
_POST_ID = find_comment_id( _AUTHOR, _PERMLINK, _AUTHOR != '' OR _PERMLINK != '' );
_POST_ID = find_comment_id( _AUTHOR, _PERMLINK, True );
RETURN QUERY
(
......@@ -1132,7 +1132,7 @@ def setup(db):
DECLARE
__post_id INT;
BEGIN
__post_id = find_comment_id(_author,_permlink, False);
__post_id = find_comment_id(_author,_permlink, True);
RETURN QUERY
SELECT
hp.id, hp.community_id, hp.author, hp.permlink, hp.title, hp.body,
......@@ -1156,7 +1156,7 @@ def setup(db):
AND NOT hp1.is_muted
AND hp1.cashout_time > _cashout_time
OR hp1.cashout_time = _cashout_time
AND hp1.id >= __post_id
AND hp1.id >= __post_id AND hp1.id != 0
ORDER BY
hp1.cashout_time ASC,
hp1.id ASC
......@@ -1207,6 +1207,7 @@ def setup(db):
AND ha.name > _author
OR ha.name = _author
AND hpd.permlink >= _permlink
AND hp1.id != 0
ORDER BY
ha.name ASC,
hpd.permlink ASC
......@@ -1335,9 +1336,9 @@ def setup(db):
$function$
DECLARE
__post_id INT;
__parent_id INT;
__parent_author_id INT;
BEGIN
__parent_id = find_account_id(_parent_author, True);
__parent_author_id = find_account_id(_parent_author, True);
__post_id = find_comment_id(_start_post_author, _start_post_permlink, True);
RETURN QUERY
SELECT
......@@ -1357,10 +1358,12 @@ def setup(db):
hp1.id
FROM
hive_posts hp1
JOIN
hive_posts hp2 ON hp1.parent_id = hp2.id
WHERE
hp1.counter_deleted = 0
AND NOT hp1.is_muted
AND hp1.parent_id = __parent_id
AND hp2.author_id = __parent_author_id
AND (
hp1.updated_at < _updated_at
OR hp1.updated_at = _updated_at
......
......@@ -41,9 +41,9 @@ async def list_comments(context, start: list, limit: int, order: str):
elif order == 'by_root':
assert len(start) == 4, "Expecting 4 arguments"
root_author = start[0]
valid_account(root_author, allow_empty=True)
valid_account(root_author)
root_permlink = start[1]
valid_permlink(root_permlink, allow_empty=True)
valid_permlink(root_permlink)
start_post_author = start[2]
valid_account(start_post_author, allow_empty=True)
start_post_permlink = start[3]
......@@ -53,9 +53,9 @@ async def list_comments(context, start: list, limit: int, order: str):
elif order == 'by_parent':
assert len(start) == 4, "Expecting 4 arguments"
parent_author = start[0]
valid_account(parent_author, allow_empty=True)
valid_account(parent_author)
parent_permlink = start[1]
valid_permlink(parent_permlink, allow_empty=True)
valid_permlink(parent_permlink)
start_post_author = start[2]
valid_account(start_post_author, allow_empty=True)
start_post_permlink = start[3]
......@@ -65,7 +65,7 @@ async def list_comments(context, start: list, limit: int, order: str):
elif order == 'by_last_update':
assert len(start) == 4, "Expecting 4 arguments"
parent_author = start[0]
valid_account(parent_author, allow_empty=True)
valid_account(parent_author)
updated_at = start[1]
valid_date(updated_at)
start_post_author = start[2]
......@@ -77,7 +77,7 @@ async def list_comments(context, start: list, limit: int, order: str):
elif order == 'by_author_last_update':
assert len(start) == 4, "Expecting 4 arguments"
author = start[0]
valid_account(author, allow_empty=True)
valid_account(author)
updated_at = start[1]
valid_date(updated_at)
start_post_author = start[2]
......
Subproject commit c83d55ec47ba9f44d80397dbf82190bc02233625
Subproject commit 3cd1c56516255b8ed00fa4809da0982c27875900
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