diff --git a/r2/r2/lib/db/_sorts.pyx b/r2/r2/lib/db/_sorts.pyx index 0c3b4c3f7..8b65c650e 100644 --- a/r2/r2/lib/db/_sorts.pyx +++ b/r2/r2/lib/db/_sorts.pyx @@ -53,7 +53,7 @@ cpdef double _hot(long ups, long downs, double date): else: sign = 0 seconds = date - 1134028003 - return round(order + sign * seconds / 45000, 7) + return round(sign * order + seconds / 45000, 7) cpdef double controversy(long ups, long downs): """The controversy sort.""" diff --git a/sql/functions.sql b/sql/functions.sql index 7e1225353..f9b93ca72 100755 --- a/sql/functions.sql +++ b/sql/functions.sql @@ -21,7 +21,7 @@ ------------------------------------------------------------------------------- create or replace function hot(ups integer, downs integer, date timestamp with time zone) returns numeric as $$ - select round(cast(log(greatest(abs($1 - $2), 1)) + sign($1 - $2) * (date_part('epoch', $3) - 1134028003) / 45000.0 as numeric), 7) + select round(cast(log(greatest(abs($1 - $2), 1)) * sign($1 - $2) + (date_part('epoch', $3) - 1134028003) / 45000.0 as numeric), 7) $$ language sql immutable; create or replace function score(ups integer, downs integer) returns integer as $$