use act index in item queries

This commit is contained in:
keyan 2022-05-16 17:18:11 -05:00
parent 29fb37b763
commit efa267f128
1 changed files with 2 additions and 2 deletions

View File

@ -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`
}