|
|
@@ -1301,19 +1301,21 @@ function echoRanklist($config = array()) {
|
|
|
$header_row .= '</tr>';
|
|
|
|
|
|
$users = array();
|
|
|
- $print_row = function($user, $now_cnt) use (&$users) {
|
|
|
- if (!$users) {
|
|
|
+ $relcnt = 0;
|
|
|
+ $print_row = function($user, $now_cnt) use (&$users, &$relcnt) {
|
|
|
+ #if (!$users) {
|
|
|
$rank = DB::selectCount("select count(*) from user_info where rating > {$user['rating']}") + 1;
|
|
|
- } elseif ($user['rating'] == $users[count($users) - 1]['rating']) {
|
|
|
- $rank = $users[count($users) - 1]['rank'];
|
|
|
- } else {
|
|
|
- $rank = $now_cnt;
|
|
|
- }
|
|
|
+# } elseif ($user['rating'] == $users[count($users) - 1]['rating']) {
|
|
|
+# $rank = $users[count($users) - 1]['rank'];
|
|
|
+# } else {
|
|
|
+# $rank = $now_cnt;
|
|
|
+# }
|
|
|
|
|
|
$user['rank'] = $rank;
|
|
|
+ $relcnt++;
|
|
|
|
|
|
echo '<tr>';
|
|
|
- echo '<td>' . $user['rank'] . '</td>';
|
|
|
+ echo '<td>' . $user['rank'] . ' (' . $relcnt . ')</td>';
|
|
|
echo '<td>' . getAvatar($user) . '</td>';
|
|
|
echo '<td>' . getUserLink($user['username']) . '</td>';
|
|
|
echo '<td>' . HTML::escape($user['motto']) . '</td>';
|
|
|
@@ -1322,8 +1324,11 @@ function echoRanklist($config = array()) {
|
|
|
|
|
|
$users[] = $user;
|
|
|
};
|
|
|
- $col_names = array('username', 'email', 'qq', 'rating', 'motto', 'rating_rd');
|
|
|
- $tail = 'order by rating desc, username asc';
|
|
|
+ $col_names = array('username', 'email', 'qq', 'rating', 'motto');
|
|
|
+ $tail = 'inner join contests_registrants c on user_info.username = c.username inner join contests s on s.id = c.contest_id where datediff(now(), s.start_time) <= 180 group by c.username having cnt >= 3 order by rating desc, username asc';
|
|
|
+ # $tail = 'order by rating desc, username asc';
|
|
|
+ #
|
|
|
+ $config['raw_sql'] = 'select u.username, u.email, u.rating, u.rating_rd, u.rating_vol, u.motto, u.qq, count(*) cnt from user_info u inner join contests_registrants c on u.username = c.username inner join contests s on s.id = c.contest_id where datediff(now(), s.start_time) <= 180 group by c.username having cnt >= 3 order by rating desc, username asc';
|
|
|
|
|
|
if (isset($config['top10'])) {
|
|
|
$tail .= ' limit 10';
|