From 2f4ed55d9dd0477a80fdda692ffbfd87ff779399 Mon Sep 17 00:00:00 2001
From: Baoshuo
Date: Thu, 17 Mar 2022 11:02:44 +0800
Subject: [PATCH] feat(*): remove rating
---
db/app_uoj233.sql | 3 -
web/app/controllers/contest_inside.php | 26 +---
web/app/controllers/contest_manage.php | 49 +-----
web/app/controllers/contest_members.php | 39 +----
web/app/controllers/contest_registration.php | 4 +-
web/app/controllers/index.php | 9 --
web/app/controllers/ranklist.php | 6 +-
web/app/controllers/subdomain/blog/blog.php | 3 -
web/app/controllers/user_info.php | 153 +------------------
web/app/libs/uoj-contest-lib.php | 100 +-----------
web/app/libs/uoj-html-lib.php | 50 +-----
web/app/locale/basic/en.php | 3 -
web/app/locale/basic/zh-cn.php | 3 -
web/app/models/HTML.php | 1 -
web/app/route.php | 1 -
web/app/views/page-header.php | 12 +-
web/js/jquery.flot.canvas.min.js | 7 -
web/js/jquery.flot.categories.min.js | 7 -
web/js/jquery.flot.crosshair.min.js | 7 -
web/js/jquery.flot.errorbars.min.js | 7 -
web/js/jquery.flot.fillbetween.min.js | 7 -
web/js/jquery.flot.image.min.js | 7 -
web/js/jquery.flot.min.js | 8 -
web/js/jquery.flot.navigate.min.js | 7 -
web/js/jquery.flot.pie.min.js | 7 -
web/js/jquery.flot.resize.min.js | 7 -
web/js/jquery.flot.selection.min.js | 7 -
web/js/jquery.flot.stack.min.js | 7 -
web/js/jquery.flot.symbol.min.js | 7 -
web/js/jquery.flot.threshold.min.js | 7 -
web/js/jquery.flot.time.min.js | 7 -
web/js/uoj.js | 75 +--------
32 files changed, 29 insertions(+), 614 deletions(-)
delete mode 100644 web/js/jquery.flot.canvas.min.js
delete mode 100644 web/js/jquery.flot.categories.min.js
delete mode 100644 web/js/jquery.flot.crosshair.min.js
delete mode 100644 web/js/jquery.flot.errorbars.min.js
delete mode 100644 web/js/jquery.flot.fillbetween.min.js
delete mode 100644 web/js/jquery.flot.image.min.js
delete mode 100644 web/js/jquery.flot.min.js
delete mode 100644 web/js/jquery.flot.navigate.min.js
delete mode 100644 web/js/jquery.flot.pie.min.js
delete mode 100644 web/js/jquery.flot.resize.min.js
delete mode 100644 web/js/jquery.flot.selection.min.js
delete mode 100644 web/js/jquery.flot.stack.min.js
delete mode 100644 web/js/jquery.flot.symbol.min.js
delete mode 100644 web/js/jquery.flot.threshold.min.js
delete mode 100644 web/js/jquery.flot.time.min.js
diff --git a/db/app_uoj233.sql b/db/app_uoj233.sql
index b20be87..ec27022 100644
--- a/db/app_uoj233.sql
+++ b/db/app_uoj233.sql
@@ -291,7 +291,6 @@ UNLOCK TABLES;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `contests_registrants` (
`username` varchar(20) NOT NULL,
- `user_rating` int(11) NOT NULL,
`contest_id` int(11) NOT NULL,
`has_participated` tinyint(1) NOT NULL,
`rank` int(11) NOT NULL,
@@ -622,7 +621,6 @@ CREATE TABLE `user_info` (
`email` varchar(50) NOT NULL,
`password` char(32) NOT NULL,
`svn_password` char(10) NOT NULL,
- `rating` int(11) NOT NULL DEFAULT '1500',
`qq` bigint(20) NOT NULL,
`sex` char(1) NOT NULL DEFAULT 'U',
`ac_num` int(11) NOT NULL,
@@ -632,7 +630,6 @@ CREATE TABLE `user_info` (
`remember_token` char(60) NOT NULL,
`motto` varchar(200) NOT NULL,
PRIMARY KEY (`username`),
- KEY `rating` (`rating`,`username`),
KEY `ac_num` (`ac_num`,`username`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;
diff --git a/web/app/controllers/contest_inside.php b/web/app/controllers/contest_inside.php
index b705e73..0d488b0 100644
--- a/web/app/controllers/contest_inside.php
+++ b/web/app/controllers/contest_inside.php
@@ -120,35 +120,11 @@
global $contest;
$contest_data = queryContestData($contest);
calcStandings($contest, $contest_data, $score, $standings, true);
- if (!isset($contest['extra_config']['unrated'])) {
- $rating_k = isset($contest['extra_config']['rating_k']) ? $contest['extra_config']['rating_k'] : 400;
- $ratings = calcRating($standings, $rating_k);
- } else {
- $ratings = array();
- for ($i = 0; $i < count($standings); $i++) {
- $ratings[$i] = $standings[$i][2][1];
- }
- }
for ($i = 0; $i < count($standings); $i++) {
$user = queryUser($standings[$i][2][0]);
- $change = $ratings[$i] - $user['rating'];
$user_link = getUserLink($user['username']);
- if ($change != 0) {
- $tail = '' . ($change > 0 ? '+' : '') . $change . '';
- $content = <<
您在 {$contest['name']} 这场比赛后的Rating变化为${tail},当前Rating为 {$ratings[$i]}。
-EOD; - } else { - $content = <<您在 {$contest['name']} 这场比赛后Rating没有变化。当前Rating为 {$ratings[$i]}。
-EOD; - } - sendSystemMsg($user['username'], 'Rating变化通知', $content); - DB::query("update user_info set rating = {$ratings[$i]} where username = '{$standings[$i][2][0]}'"); DB::query("update contests_registrants set rank = {$standings[$i][3]} where contest_id = {$contest['id']} and username = '{$standings[$i][2][0]}'"); } DB::query("update contests set status = 'finished' where id = {$contest['id']}"); @@ -550,4 +526,4 @@ EOD; - \ No newline at end of file + diff --git a/web/app/controllers/contest_manage.php b/web/app/controllers/contest_manage.php index 1958de9..64842dc 100644 --- a/web/app/controllers/contest_manage.php +++ b/web/app/controllers/contest_manage.php @@ -116,43 +116,6 @@ ); if (isSuperUser($myUser)) { - $rating_k_form = new UOJForm('rating_k'); - $rating_k_form->addInput('rating_k', 'text', 'rating 变化上限', isset($contest['extra_config']['rating_k']) ? $contest['extra_config']['rating_k'] : 400, - function ($x) { - if (!validateUInt($x) || $x < 1 || $x > 1000) { - return '不合法的上限'; - } - return ''; - }, - null - ); - $rating_k_form->handle = function() { - global $contest; - $contest['extra_config']['rating_k'] = $_POST['rating_k']; - $esc_extra_config = json_encode($contest['extra_config']); - $esc_extra_config = DB::escape($esc_extra_config); - DB::update("update contests set extra_config = '$esc_extra_config' where id = {$contest['id']}"); - }; - $rating_k_form->runAtServer(); - - $rated_form = new UOJForm('rated'); - $rated_form->handle = function() { - global $contest; - if (isset($contest['extra_config']['unrated'])) { - unset($contest['extra_config']['unrated']); - } else { - $contest['extra_config']['unrated'] = ''; - } - $esc_extra_config = json_encode($contest['extra_config']); - $esc_extra_config = DB::escape($esc_extra_config); - DB::update("update contests set extra_config = '$esc_extra_config' where id = {$contest['id']}"); - }; - $rated_form->submit_button_config['class_str'] = 'btn btn-warning btn-block'; - $rated_form->submit_button_config['text'] = isset($contest['extra_config']['unrated']) ? '设置比赛为rated' : '设置比赛为unrated'; - $rated_form->submit_button_config['smart_confirm'] = ''; - - $rated_form->runAtServer(); - $version_form = new UOJForm('version'); $version_form->addInput('standings_version', 'text', '排名版本', $contest['extra_config']['standings_version'], function ($x) { @@ -260,16 +223,6 @@= $user['rating'] ?>
-= $esc_email ?>
@@ -77,10 +71,6 @@禁止入内! T_T