From e60411bee79dd963608fcfbc29ca1857c64b8e6d Mon Sep 17 00:00:00 2001
From: jsalyers <jsalyers@syncad.com>
Date: Tue, 10 Nov 2020 19:13:26 -0500
Subject: [PATCH] [JES] Fix a broken query

---
 .../bridge_get_ranked_post_for_observer_communities.sql     | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/hive/db/sql_scripts/bridge_get_ranked_post_for_observer_communities.sql b/hive/db/sql_scripts/bridge_get_ranked_post_for_observer_communities.sql
index 290e0f324..a5924e6fc 100644
--- a/hive/db/sql_scripts/bridge_get_ranked_post_for_observer_communities.sql
+++ b/hive/db/sql_scripts/bridge_get_ranked_post_for_observer_communities.sql
@@ -45,7 +45,8 @@ BEGIN
       hp.community_title,
       hp.role_id,
       hp.is_pinned,
-      hp.curator_payout_value
+      hp.curator_payout_value,
+      hp.is_muted
   FROM
       hive_posts_view hp
       JOIN hive_subscriptions hs ON hp.community_id = hs.community_id
@@ -394,12 +395,11 @@ BEGIN
       WHERE
           ha.name = _observer AND hp1.counter_deleted = 0 AND NOT hp1.is_paidout AND hp1.depth = 0
           AND ( __post_id = 0 OR hp1.sc_trend < __trending_limit OR ( hp1.sc_trend = __trending_limit AND hp1.id < __post_id ) )
-          AND hp.author NOT IN (SELECT muted FROM muted_accounts_view WHERE observer = _observer)
       ORDER BY hp1.sc_trend DESC, hp1.id DESC
       LIMIT _limit
   ) trending
   JOIN hive_posts_view hp ON trending.id = hp.id
-  
+  WHERE hp.author NOT IN (SELECT muted FROM muted_accounts_view WHERE observer = _observer)
   ORDER BY trending.sc_trend DESC, trending.id DESC
   LIMIT _limit;
 END
-- 
GitLab