High Scores head=> body<= The following people have helped other users in the support area: prepare("SELECT statcat, statkey, statval FROM stats ". "WHERE statcat IN ('supportrank', 'supportrank_prev')"); $sth->execute; while (my ($cat, $userid, $rank) = $sth->fetchrow_array) { if ($cat eq "supportrank") { $rank{$userid}->{'now'} = $rank; } else { $rank{$userid}->{'last'} = $rank; } } return "
Support high score data is not available.
" unless %rank; $sth = $dbr->prepare("SELECT u.userid, u.user, u.name, sp.totpoints AS 'points', sp.lastupdate ". "FROM user u, supportpointsum sp WHERE u.userid=sp.userid"); $sth->execute; my @rows; push @rows, $_ while $_ = $sth->fetchrow_hashref; if ($GET{'sort'} eq "lastupdate") { @rows = sort { $b->{lastupdate} <=> $a->{lastupdate} } @rows; } else { @rows = sort { $b->{points} <=> $a->{points} } @rows; } my $page = $GET{page}+0; my $shown = 100 * ($page - 1) - 1; my $rank = 0; my $lastpoints = 0; my $buildup = 0; foreach (@rows[0..$shown]) { if ($_->{'points'} != $lastpoints) { $lastpoints = $_->{'points'}; $rank += (1 + $buildup); $buildup = 0; } else { $buildup++; } } my $total = scalar(@rows); my %items = BML::paging(\@rows, $GET{'page'}, 100); my $navbar = LJ::paging_bar($items{'page'}, $items{'pages'}); @rows = @{$items{'items'}}; my $ret = $navbar; $ret .= ""; my $count = 0; foreach (@rows) { $count++; my $userid = $_->{'userid'}; if ($_->{'points'} != $lastpoints) { $lastpoints = $_->{'points'}; $rank += (1 + $buildup); $buildup = 0; } else { $buildup++; } my $change = ""; if ($rank{$userid}->{'now'} && $rank{$userid}->{'last'}) { $change = $rank{$userid}->{'last'} - $rank{$userid}->{'now'}; # from 5th to 4th is 5-4 = 1 (+1 for increase) if ($change == 0) { $change = ""; } elsif ($change > 0) { $change = "(+$change)"; } else { $change = "($change)"; } } my $pts = $_->{'points'}; my $s = $pts > 1 ? "s" : ""; my $name = LJ::ehtml($_->{'name'}); $ret .= "\n"; } $ret .= "
$rank.$change{'user'} ljuser?> - $name$_->{'points'} point$s
"; $ret .= "

$total total supporting users, $count displayed.

"; $ret .= $navbar; return $ret; _code?> Back to the support area. <=body page?> link: htdocs/admin/priv/index.bml, htdocs/support/index.bml _c?>