@Test public void score_by_mixed() throws Exception { assertEquals(2.920d, HotRanking.score(10, 0, dayAt(1, 2)), precision); assertEquals(4.539d, HotRanking.score(30, 25, dayAt(1, 3)), precision); assertEquals(4.840d, HotRanking.score(10, 0, dayAt(1, 3)), precision); assertEquals(5.840d, HotRanking.score(100, 0, dayAt(1, 3)), precision); assertEquals(6.840d, HotRanking.score(1000, 0, dayAt(1, 3)), precision); assertEquals(5.760d, HotRanking.score(0, 0, dayAt(1, 4)), precision); assertEquals(6.760d, HotRanking.score(10, 0, dayAt(1, 4)), precision); }
public static double score(long upVoted, long downVoted, Instant createTime) { long s = total(upVoted, downVoted); double order = log10(max(abs(s), 1)); double sign = Long.signum(s); long seconds = Duration.between(BASE_TIME, createTime).getSeconds(); return sign * order + seconds / 45000.0; }
HotRanking { public static double score(long upVoted, long downVoted, Instant createTime) { long s = total(upVoted, downVoted); double order = log10(max(abs(s), 1)); double sign = Long.signum(s); long seconds = Duration.between(BASE_TIME, createTime).getSeconds(); return sign * order + seconds / 45000.0; } }
HotRanking { public static double score(long upVoted, long downVoted, Instant createTime) { long s = total(upVoted, downVoted); double order = log10(max(abs(s), 1)); double sign = Long.signum(s); long seconds = Duration.between(BASE_TIME, createTime).getSeconds(); return sign * order + seconds / 45000.0; }  }
HotRanking { public static double score(long upVoted, long downVoted, Instant createTime) { long s = total(upVoted, downVoted); double order = log10(max(abs(s), 1)); double sign = Long.signum(s); long seconds = Duration.between(BASE_TIME, createTime).getSeconds(); return sign * order + seconds / 45000.0; }  static double score(long upVoted, long downVoted, Instant createTime); }
HotRanking { public static double score(long upVoted, long downVoted, Instant createTime) { long s = total(upVoted, downVoted); double order = log10(max(abs(s), 1)); double sign = Long.signum(s); long seconds = Duration.between(BASE_TIME, createTime).getSeconds(); return sign * order + seconds / 45000.0; }  static double score(long upVoted, long downVoted, Instant createTime);  }