From d86bf302eeaf29a50db106dd4b17dc6c069d9034 Mon Sep 17 00:00:00 2001 From: keyan Date: Fri, 1 Jul 2022 13:38:47 -0500 Subject: [PATCH] make upvoted items sticker posts/comments --- 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 76def6be..2bb8f0d2 100644 --- a/api/resolvers/item.js +++ b/api/resolvers/item.js @@ -34,7 +34,7 @@ async function comments (models, id, sort) { } const COMMENTS_ORDER_BY_SATS = - 'ORDER BY "Item"."weightedVotes"/POWER(EXTRACT(EPOCH FROM ((NOW() AT TIME ZONE \'UTC\') - "Item".created_at))/3600+2, 1.3) DESC NULLS LAST, "Item".id DESC' + 'ORDER BY POWER("Item"."weightedVotes", 1.2)/POWER(EXTRACT(EPOCH FROM ((NOW() AT TIME ZONE \'UTC\') - "Item".created_at))/3600+2, 1.3) DESC NULLS LAST, "Item".id DESC' export async function getItem (parent, { id }, { models }) { const [item] = await models.$queryRaw(` @@ -841,7 +841,7 @@ export const SELECT = function newTimedOrderByWeightedSats (num) { return ` - ORDER BY (POWER("Item"."weightedVotes", 1.1)/POWER(EXTRACT(EPOCH FROM ($${num} - "Item".created_at))/3600+2, 1.3) + + ORDER BY (POWER("Item"."weightedVotes", 1.2)/POWER(EXTRACT(EPOCH FROM ($${num} - "Item".created_at))/3600+2, 1.3) + GREATEST("Item".boost-1000+5, 0)/POWER(EXTRACT(EPOCH FROM ($${num} - "Item".created_at))/3600+2, 4)) DESC NULLS LAST, "Item".id DESC` }