allow top sorting by boost

This commit is contained in:
k00b 2024-09-21 14:58:25 -05:00
parent 83458fdc9e
commit 894d02a196
2 changed files with 5 additions and 1 deletions

View File

@ -105,6 +105,8 @@ const orderByClause = (by, me, models, type) => {
return 'ORDER BY "Item".msats DESC'
case 'zaprank':
return topOrderByWeightedSats(me, models)
case 'boost':
return 'ORDER BY "Item".boost DESC'
case 'random':
return 'ORDER BY RANDOM()'
default:
@ -378,6 +380,7 @@ export default {
activeOrMine(me),
nsfwClause(showNsfw),
typeClause(type),
by === 'boost' && '"Item".boost > 0',
whenClause(when || 'forever', table))}
${orderByClause(by, me, models, type)}
OFFSET $4
@ -421,6 +424,7 @@ export default {
typeClause(type),
whenClause(when, 'Item'),
await filterClause(me, models, type),
by === 'boost' && '"Item".boost > 0',
muteClause(me))}
${orderByClause(by || 'zaprank', me, models, type)}
OFFSET $3

View File

@ -62,7 +62,7 @@ export const ITEM_FILTER_THRESHOLD = 1.2
export const DONT_LIKE_THIS_COST = 1
export const COMMENT_TYPE_QUERY = ['comments', 'freebies', 'outlawed', 'borderland', 'all', 'bookmarks']
export const USER_SORTS = ['value', 'stacking', 'spending', 'comments', 'posts', 'referrals']
export const ITEM_SORTS = ['zaprank', 'comments', 'sats']
export const ITEM_SORTS = ['zaprank', 'comments', 'sats', 'boost']
export const SUB_SORTS = ['stacking', 'revenue', 'spending', 'posts', 'comments']
export const WHENS = ['day', 'week', 'month', 'year', 'forever', 'custom']
export const ITEM_TYPES_USER = ['all', 'posts', 'comments', 'bounties', 'links', 'discussions', 'polls', 'freebies', 'jobs', 'bookmarks']