From efa267f128dc8621dd8c74d9002bce3985d9c737 Mon Sep 17 00:00:00 2001 From: keyan Date: Mon, 16 May 2022 17:18:11 -0500 Subject: [PATCH] use act index in item queries --- api/resolvers/item.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/api/resolvers/item.js b/api/resolvers/item.js index bf651486..c5ffa5a8 100644 --- a/api/resolvers/item.js +++ b/api/resolvers/item.js @@ -45,7 +45,7 @@ const COMMENTS_LEFT_JOIN_WEIGHTED_SATS = ${COMMENTS_LEFT_JOIN_WEIGHTED_SATS_SELECT} FROM "ItemAct" JOIN users on "ItemAct"."userId" = users.id - WHERE "Item".id = "ItemAct"."itemId" + WHERE "Item".id = "ItemAct"."itemId" AND "ItemAct".act = 'VOTE' GROUP BY "Item".id ) x ON "Item".id = x.id` const COMMENTS_ORDER_BY_SATS = @@ -860,7 +860,7 @@ export const SELECT = function newTimedLeftJoinWeightedSats (num) { return ` - LEFT JOIN "ItemAct" ON "Item".id = "ItemAct"."itemId" AND "ItemAct".created_at <= $${num} + LEFT JOIN "ItemAct" ON "Item".id = "ItemAct"."itemId" AND "ItemAct".created_at <= $${num} AND "ItemAct".act IN ('VOTE', 'BOOST') JOIN users ON "ItemAct"."userId" = users.id` }