all things being equal, sort comments by sats
This commit is contained in:
parent
f6a95c81eb
commit
439c83f975
|
@ -14,13 +14,13 @@ async function comments (me, models, id, sort) {
|
|||
let orderBy
|
||||
switch (sort) {
|
||||
case 'top':
|
||||
orderBy = `ORDER BY ${await orderByNumerator(me, models)} DESC, "Item".id DESC`
|
||||
orderBy = `ORDER BY ${await orderByNumerator(me, models)} DESC, "Item".msats DESC, "Item".id DESC`
|
||||
break
|
||||
case 'recent':
|
||||
orderBy = 'ORDER BY "Item".created_at DESC, "Item".id DESC'
|
||||
orderBy = 'ORDER BY "Item".created_at DESC, "Item".msats DESC, "Item".id DESC'
|
||||
break
|
||||
default:
|
||||
orderBy = `ORDER BY ${await orderByNumerator(me, models)}/POWER(GREATEST(3, EXTRACT(EPOCH FROM (now_utc() - "Item".created_at))/3600), 1.3) DESC NULLS LAST, "Item".id DESC`
|
||||
orderBy = `ORDER BY ${await orderByNumerator(me, models)}/POWER(GREATEST(3, EXTRACT(EPOCH FROM (now_utc() - "Item".created_at))/3600), 1.3) DESC NULLS LAST, "Item".msats DESC, "Item".id DESC`
|
||||
break
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue