just a random stranger

codeberg: https://codeberg.org/asudox

aspe:keyoxide.org:D63IYCGSU4XXB5JSCBBHXXFEHQ

  • 7 Posts
  • 153 Comments
Joined 3 months ago
cake
Cake day: January 18th, 2025

help-circle











  • No, it is not weird. Scaled, according to the docs, is like Hot, but less active communities’ posts get a boost.

    Edit: here’s a bit more detail

    The exact function to calculate the scaled rank is this one:

    CREATE OR REPLACE FUNCTION scaled_rank (score numeric, published timestamp with time zone, users_active_month numeric)
        RETURNS float
        AS $$
    BEGIN
        -- Add 2 to avoid divide by zero errors
        -- Default for score = 1, active users = 1, and now, is (0.1728 / log(2 + 1)) = 0.3621
        -- There may need to be a scale factor multiplied to users_active_month, to make
        -- the log curve less pronounced. This can be tuned in the future.
        RETURN (hot_rank (score, published) / log(2 + users_active_month));
    END;
    

    The hot rank is calculated like this:

    CREATE OR REPLACE FUNCTION hot_rank (score numeric, published timestamp without time zone)
        RETURNS integer
        AS $$
    BEGIN
        -- hours_diff:=EXTRACT(EPOCH FROM (timezone('utc',now()) - published))/3600
        RETURN floor(10000 * log(greatest (1, score + 3)) / power(((EXTRACT(EPOCH FROM (timezone('utc', now()) - published)) / 3600) + 2), 1.8))::integer;
    END;