@Test public void score_by_total() throws Exception { assertEquals(0.000d, HotRanking.score(0, 0, dayAt(1, 1)), precision); assertEquals(1.000d, HotRanking.score(10, 0, dayAt(1, 1)), precision); assertEquals(1.176d, HotRanking.score(15, 0, dayAt(1, 1)), precision); assertEquals(2.000d, HotRanking.score(100, 0, dayAt(1, 1)), precision); assertEquals(3.000d, HotRanking.score(1000, 0, dayAt(1, 1)), precision); assertEquals(3.000d, HotRanking.score(2000, 1000, dayAt(1, 1)), precision); assertEquals(-3.000d, HotRanking.score(1000, 2000, dayAt(1, 1)), 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);  }