Skip to content

Commit

Permalink
trending update
Browse files Browse the repository at this point in the history
  • Loading branch information
Dromader2137 committed May 23, 2024
1 parent c88e713 commit fb2e047
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 6 additions & 0 deletions scripts/test-posts.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,23 @@ ip=$1

token_1=$(./scripts/login.sh $ip admin admin false)
tok_1=$token_1
tok_2=$(./scripts/signup.sh $ip t1 admin false)
tok_3=$(./scripts/signup.sh $ip t2 admin false)
./scripts/create-post.sh $ip hello welcome yo $tok_1
./scripts/react.sh $ip 0 $tok_1
./scripts/react.sh $ip 0 $tok_2
./scripts/react.sh $ip 0 $tok_3
./scripts/create-post.sh $ip hello welcome yo $tok_1
./scripts/react.sh $ip 1 $tok_1
./scripts/create-post.sh $ip hello welcome yo $tok_1
./scripts/create-post.sh $ip hello welcome yo $tok_1
./scripts/create-post.sh $ip hello welcome yo $tok_1
./scripts/react.sh $ip 4 $tok_3
./scripts/create-post.sh $ip hello welcome yo $tok_1
./scripts/create-post.sh $ip hello welcome yo $tok_1
./scripts/create-post.sh $ip hello welcome yo $tok_1
./scripts/create-post.sh $ip hello welcome yo $tok_1
./scripts/react.sh $ip 8 $tok_2
./scripts/create-post.sh $ip hello welcome yo $tok_1
./scripts/create-post.sh $ip hello welcome yo $tok_1
./scripts/create-post.sh $ip hello welcome yo $tok_1
Expand Down
2 changes: 1 addition & 1 deletion src/api_calls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ pub async fn get_posts_trending(limit: i64, offset: i64, date_from: i64) -> Resu
WHERE
posts.user_id NOT IN (SELECT user_id FROM bans WHERE is_active = 1 AND expires_on > {})
AND posts.date > ?
ORDER BY (posts.likes / (({} - posts.date) / 60)) ASC
ORDER BY (posts.likes / (({} - posts.date + 3600) / 3600)) DESC
LIMIT ? OFFSET ?",
timestamp, timestamp
);
Expand Down

0 comments on commit fb2e047

Please sign in to comment.