Skip to content
Snippets Groups Projects
Commit 338af711 authored by Gandalf's avatar Gandalf
Browse files

[JES] Fix tags. Was mistakenly using category instead of hive_post_tags table

parent 0bcdc050
No related branches found
No related tags found
5 merge requests!456Release candidate v1 24,!230Setup monitoring with pghero,!135Enable postgres monitoring on CI server,!16Dk issue 3 concurrent block query rebase,!15Dk issue 3 concurrent block query
......@@ -239,26 +239,26 @@ async def get_ranked_posts(context, sort, start_author='', start_permlink='',
else:
if start_author and start_permlink:
if sort == 'trending':
sql = sql % """ AND hive_posts_cache.category = :tag
sql = sql % """ AND hive_posts_cache.post_id IN (SELECT post_id FROM hive_post_tags WHERE tag = :tag)
AND hive_posts_cache.sc_trend <= (SELECT sc_trend FROM hive_posts_cache WHERE permlink = :permlink AND author = :author)
AND hive_posts_cache.post_id != (SELECT post_id FROM hive_posts_cache WHERE permlink = :permlink AND author = :author)
"""
elif sort == 'hot':
sql = sql % """ AND hive_posts_cache.category = :tag
sql = sql % """ AND hive_posts_cache.post_id IN (SELECT post_id FROM hive_post_tags WHERE tag = :tag)
AND hive_posts_cache.sc_hot <= (SELECT sc_hot FROM hive_posts_cache WHERE permlink = :permlink AND author = :author)
AND hive_posts_cache.post_id != (SELECT post_id FROM hive_posts_cache WHERE permlink = :permlink AND author = :author)
"""
elif sort == 'created':
sql = sql % """ AND hive_posts_cache.category = :tag
sql = sql % """ AND hive_posts_cache.post_id IN (SELECT post_id FROM hive_post_tags WHERE tag = :tag)
AND hive_posts_cache.post_id < (SELECT post_id FROM hive_posts_cache WHERE permlink = :permlink AND author = :author)
"""
elif sort == 'promoted':
sql = sql % """ AND hive_posts_cache.category = :tag
sql = sql % """ AND hive_posts_cache.post_id IN (SELECT post_id FROM hive_post_tags WHERE tag = :tag)
AND hive_posts_cache.promoted <= (SELECT promoted FROM hive_posts_cache WHERE permlink = :permlink AND author = :author)
AND hive_posts_cache.post_id != (SELECT post_id FROM hive_posts_cache WHERE permlink = :permlink AND author = :author)
"""
else:
sql = sql % """ AND hive_posts_cache.category = :tag
sql = sql % """ AND hive_posts_cache.post_id IN (SELECT post_id FROm hive_post_tags WHERE tag = :tag)
AND hive_posts_cache.payout <= (SELECT payout FROM hive_posts_cache WHERE permlink = :permlink AND author = :author)
AND hive_posts_cache.post_id != (SELECT post_id FROM hive_posts_cache WHERE permlink = :permlink AND author = :author)
"""
......
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