diff --git a/scripts/test-posts.sh b/scripts/test-posts.sh index cf766e4..85ccbda 100755 --- a/scripts/test-posts.sh +++ b/scripts/test-posts.sh @@ -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 diff --git a/src/api_calls.rs b/src/api_calls.rs index 07422e7..c3399f3 100644 --- a/src/api_calls.rs +++ b/src/api_calls.rs @@ -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 );