Mix awarded score into ranks

This commit is contained in:
2025-09-08 23:45:57 +08:00
parent c2b49e6642
commit ab2bdcc7ca
2 changed files with 12 additions and 5 deletions

View File

@@ -19,12 +19,12 @@ public class ActivityService(
{
private static double CalculateHotRank(Post.Post post, Instant now)
{
var performanceScore = post.Upvotes - post.Downvotes + post.RepliesCount;
var performanceScore = post.Upvotes - post.Downvotes + post.RepliesCount + (int)post.AwardedScore / 10;
var postTime = post.PublishedAt ?? post.CreatedAt;
var timeScore = (now - postTime).TotalMinutes;
// Add 1 to score to prevent negative results for posts with more downvotes than upvotes
// Time dominates ranking, performance adjusts within similar timeframes.
var performanceWeight = Math.Log(performanceScore + 5); // smooth adjustment, median ~4-5
var performanceWeight = performanceScore + 5;
// Normalize time influence since average post interval ~60 minutes
var normalizedTime = timeScore / 60.0;
return performanceWeight / Math.Pow(normalizedTime + 1.0, 1.2);