use act index in item queries
This commit is contained in:
parent
29fb37b763
commit
efa267f128
|
@ -45,7 +45,7 @@ const COMMENTS_LEFT_JOIN_WEIGHTED_SATS =
|
||||||
${COMMENTS_LEFT_JOIN_WEIGHTED_SATS_SELECT}
|
${COMMENTS_LEFT_JOIN_WEIGHTED_SATS_SELECT}
|
||||||
FROM "ItemAct"
|
FROM "ItemAct"
|
||||||
JOIN users on "ItemAct"."userId" = users.id
|
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
|
GROUP BY "Item".id
|
||||||
) x ON "Item".id = x.id`
|
) x ON "Item".id = x.id`
|
||||||
const COMMENTS_ORDER_BY_SATS =
|
const COMMENTS_ORDER_BY_SATS =
|
||||||
|
@ -860,7 +860,7 @@ export const SELECT =
|
||||||
|
|
||||||
function newTimedLeftJoinWeightedSats (num) {
|
function newTimedLeftJoinWeightedSats (num) {
|
||||||
return `
|
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`
|
JOIN users ON "ItemAct"."userId" = users.id`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue