Skip to content

Commit

Permalink
users.pl editComm reason modifiers were broken before, are fixed now.
Browse files Browse the repository at this point in the history
Debugging prints removed from a daily task.  And the eligible mod list
slightly randomized to help ensure fairness.
  • Loading branch information
jamiemccarthy committed Sep 7, 2002
1 parent bcbdf38 commit 43ad961
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 16 deletions.
8 changes: 5 additions & 3 deletions Slash/DB/Static/MySQL/MySQL.pm
Expand Up @@ -436,7 +436,6 @@ sub updateLastaccess {
{ lastaccess => $day },
"uid IN ($uids_in)"
);
print STDERR "lastaccess set from lastclick to $day for $uids_in\n";
}
} else {
my @gmt = gmtime(time-86400);
Expand All @@ -453,7 +452,6 @@ print STDERR "lastaccess set from lastclick to $day for $uids_in\n";
{ lastaccess => $yesterday },
"uid IN ($uids_in) AND lastaccess < '$yesterday'"
);
print STDERR "lastaccess set from accesslog to $yesterday for $uids_in\n";
}
}

Expand Down Expand Up @@ -802,6 +800,10 @@ sub getAccessLogInfo {

########################################################
# For run_moderatord.pl
# New as of 2002/09/05: returns ordered first by hitcount, and
# second randomly, so when give_out_tokens() chops off the list
# halfway through the minimum number of clicks, the survivors
# are determined at random and not by (probably) uid order.
sub fetchEligibleModerators {
my($self) = @_;
my $constants = getCurrentStatic();
Expand All @@ -825,7 +827,7 @@ sub fetchEligibleModerators {
AND karma >= 0",
"GROUP BY users_info.uid
HAVING c >= $hitcount
ORDER BY c");
ORDER BY c, RAND()");

return $returnable;
}
Expand Down
30 changes: 17 additions & 13 deletions themes/slashcode/htdocs/users.pl
Expand Up @@ -1399,20 +1399,22 @@ sub editComm {
$fieldkey = 'uid';
}

my @reasons = ();
@reasons = @{$constants->{reasons}}
if $constants->{reasons} and ref($constants->{reasons}) eq 'ARRAY';
my @reasons = ( );
my $reasons = $slashdb->getReasons();
for my $id (sort { $a <=> $b } keys %$reasons) {
push @reasons, $reasons->{$id}{name};
}

my %reason_select;

my $hi = $constants->{comment_maxscore} - $constants->{comment_minscore};
my $lo = -$hi;
# And this was wrong, see we display +3 not 3. So the display was a bit off :)
my @range = map { $_ > 0 ? '+' . $_ : $_ } ($lo .. $hi);
my @range = map { $_ > 0 ? "+$_" : $_ } ($lo .. $hi);

for (@reasons) {
my $key = "reason_alter_$_";
$reason_select{$_} = createSelect($key, \@range,
for my $reason_name (@reasons) {
my $key = "reason_alter_$reason_name";
$reason_select{$reason_name} = createSelect(
$key, \@range,
$user_edit->{$key} || 0, 1, 1
);
}
Expand Down Expand Up @@ -1935,12 +1937,14 @@ sub saveComm {
? $form->{textarea_cols} : undef),
};

my @reasons = ();
@reasons = @{$constants->{reasons}}
if $constants->{reasons} and ref($constants->{reasons}) eq 'ARRAY';
my @reasons = ( );
my $reasons = $slashdb->getReasons();
for my $id (sort { $a <=> $b } keys %$reasons) {
push @reasons, $reasons->{$id}{name};
}

for (@reasons) {
my $key = "reason_alter_$_";
for my $reason_name (@reasons) {
my $key = "reason_alter_$reason_name";
my $answer = $form->{$key};
$answer = 0 if $answer !~ /^[\-+]?\d+$/;
$users_comments_table->{$key} = ($answer == 0) ? '' : $answer;
Expand Down

0 comments on commit 43ad961

Please sign in to comment.