Skip to content

Commit

Permalink
Add "newest" 2-day cushion to moderatorlog, to go with "oldest".
Browse files Browse the repository at this point in the history
Update upgrades to show Slashdot update.
  • Loading branch information
jamiemccarthy committed Sep 13, 2002
1 parent c0c7692 commit 58a6ecb
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 10 deletions.
25 changes: 18 additions & 7 deletions Slash/DB/MySQL/MySQL.pm
Original file line number Diff line number Diff line change
Expand Up @@ -666,11 +666,15 @@ sub getMetamodsForUserRaw {
"ts < DATE_SUB(NOW(), INTERVAL $days_back DAY)");
$min_old = 0 if !$min_old;
$max_old = 0 if !$max_old;
my $min_new = $max_old+1;
my($min_new) = $self->sqlSelect("MIN(id)", "moderatorlog",
"ts >= DATE_SUB(NOW(), INTERVAL $days_back_cushion DAY)");
my($max_new) = $self->sqlSelect("MAX(id)", "moderatorlog");
$min_new = 0 if !$min_new;
$max_new = 0 if !$max_new;
$min_new = $max_new if $min_new > $max_new;
my $min_mid = $max_old+1;
my $max_mid = $min_new-1;
my $old_range = $max_old-$min_old; $old_range = 1 if $old_range < 1;
my $mid_range = $max_mid-$min_mid; $mid_range = 1 if $mid_range < 1;
my $new_range = $max_new-$min_new; $new_range = 1 if $new_range < 1;

# Prepare the lists of ids and cids to exclude.
Expand Down Expand Up @@ -714,11 +718,18 @@ sub getMetamodsForUserRaw {
$mod_hr = $self->sqlSelectAllHashref(
"id",
"id, cid,
m2count + $consensus * IF(
id BETWEEN $min_old AND $max_old,
POW((id-$min_old)/$old_range, $waitpow),
POW((id-$min_new)/$new_range, $waitpow) + 2
) + RAND() AS rank",
m2count
+ $consensus * IF(
id BETWEEN $min_old AND $max_mid,
IF(
id BETWEEN $min_old and $max_old,
POW((id-$min_old)/$old_range, $waitpow),
POW((id-$min_mid)/$mid_range, $waitpow) + 2
),
POW((id-$min_new)/$new_range, $waitpow) + 4
)
+ RAND()
AS rank",
"moderatorlog",
"uid != $uid_q AND cuid != $uid_q
AND m2status=0
Expand Down
12 changes: 9 additions & 3 deletions sql/mysql/upgrades
Original file line number Diff line number Diff line change
Expand Up @@ -718,14 +718,13 @@ INSERT INTO menus (menu, label, value, seclev, menuorder) VALUES ('zoo','Foes','
INSERT INTO menus (menu, label, value, seclev, menuorder) VALUES ('zoo','Freaks','[% constants.rootdir %]/my/freaks/',1,1);
INSERT INTO menus (menu, label, value, seclev, menuorder) VALUES ('zoo','Friends of Friends','[% constants.rootdir %]/my/friends/friends',1,1);
INSERT INTO menus (menu, label, value, seclev, menuorder) VALUES ('zoo','Foes of Friends','[% constants.rootdir %]/my/friends/foes',1,1);

DELETE FROM vars WHERE name='m2_consensus_waitmult';
INSERT INTO vars (name, value, description) VALUES ('m2_consensus_waitpow', '0.8', 'Positive real number, 0.2 to 5 is sensible. Between 0 and 1, older mods are chosen for M2 preferentially. Greater than 1, newer');

# SLASHDOT LAST UPDATED HERE

# End of T_2_3_0_45, Start of T_2_3_0_46

#One more time!
# One more time!
REPLACE INTO menus (menu, label, value, seclev, menuorder) VALUES ('zoo','Friends','[% constants.rootdir %]/my/friends/',1,1);
REPLACE INTO menus (menu, label, value, seclev, menuorder) VALUES ('zoo','Fans','[% constants.rootdir %]/my/fans/',1,2);
REPLACE INTO menus (menu, label, value, seclev, menuorder) VALUES ('zoo','Foes','[% constants.rootdir %]/my/foes/',1,3);
Expand All @@ -734,5 +733,12 @@ REPLACE INTO menus (menu, label, value, seclev, menuorder) VALUES ('zoo','Friend
REPLACE INTO menus (menu, label, value, seclev, menuorder) VALUES ('zoo','Foes of Friends','[% constants.rootdir %]/my/friends/foes',1,6);

# Rebuild Zoo at this point

# SLASHDOT LAST UPDATED HERE

# FOUNDRIES LAST UPDATED HERE 9-12-02 Hey - it's been great
# working with all of you - good luck!
# Best wishes!

# End of T_2_3_0_46

0 comments on commit 58a6ecb

Please sign in to comment.