add: order popular tabs by score instead of just likes
score = likes - dislikes
This commit is contained in:
parent
12adcd5fd3
commit
2ec56809b8
2 changed files with 2 additions and 2 deletions
|
@ -613,7 +613,7 @@ impl DataManager {
|
||||||
|
|
||||||
let res = query_rows!(
|
let res = query_rows!(
|
||||||
&conn,
|
&conn,
|
||||||
"SELECT * FROM posts WHERE replying_to = 0 AND NOT context LIKE '%\"is_nsfw\":true%' AND ($1 - created) < $2 ORDER BY likes DESC, created ASC LIMIT $3 OFFSET $4",
|
"SELECT * FROM posts WHERE replying_to = 0 AND NOT context LIKE '%\"is_nsfw\":true%' AND ($1 - created) < $2 ORDER BY likes - dislikes DESC, created ASC LIMIT $3 OFFSET $4",
|
||||||
&[
|
&[
|
||||||
&(unix_epoch_timestamp() as i64),
|
&(unix_epoch_timestamp() as i64),
|
||||||
&(cutoff as i64),
|
&(cutoff as i64),
|
||||||
|
|
|
@ -282,7 +282,7 @@ impl DataManager {
|
||||||
|
|
||||||
let res = query_rows!(
|
let res = query_rows!(
|
||||||
&conn,
|
&conn,
|
||||||
"SELECT * FROM questions WHERE is_global = 1 AND NOT context LIKE '%\"is_nsfw\":true%' AND ($1 - created) < $2 ORDER BY likes DESC, created ASC LIMIT $3 OFFSET $4",
|
"SELECT * FROM questions WHERE is_global = 1 AND NOT context LIKE '%\"is_nsfw\":true%' AND ($1 - created) < $2 ORDER BY likes - dislikes DESC, created ASC LIMIT $3 OFFSET $4",
|
||||||
&[
|
&[
|
||||||
&(unix_epoch_timestamp() as i64),
|
&(unix_epoch_timestamp() as i64),
|
||||||
&(cutoff as i64),
|
&(cutoff as i64),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue