diff --git a/db/app_uoj233.sql b/db/app_uoj233.sql index 4dd2aa8..9fb0e3a 100644 --- a/db/app_uoj233.sql +++ b/db/app_uoj233.sql @@ -626,6 +626,7 @@ CREATE TABLE `problems` ( PRIMARY KEY (`id`), KEY `assigned_to_judger` (`assigned_to_judger`), KEY `uploader` (`uploader`), + KEY `difficulty` (`difficulty`), KEY `is_hidden` (`is_hidden`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci TABLESPACE `innodb_system`; /*!40101 SET character_set_client = @saved_cs_client */; diff --git a/web/app/controllers/problem_set.php b/web/app/controllers/problem_set.php index c7886e8..e557a03 100644 --- a/web/app/controllers/problem_set.php +++ b/web/app/controllers/problem_set.php @@ -128,9 +128,7 @@ function getProblemTR($info) { ) ); } - if (isset($_COOKIE['show_difficulty'])) { - $html .= HTML::tag('td', [], UOJProblem::getDifficultyHTML($problem->info['difficulty'])); - } + $html .= HTML::tag('td', [], UOJProblem::getDifficultyHTML($problem->info['difficulty'])); $html .= HTML::tag('td', [], ClickZans::getCntBlock($problem->info['zan'])); $html .= HTML::tag_end('tr'); return $html; @@ -179,6 +177,10 @@ if (Auth::check() && isset($_GET['my'])) { $cond['problems.uploader'] = Auth::id(); } +if (isset($_GET['difficulty']) && $_GET['difficulty']) { + $cond['problems.difficulty'] = $_GET['difficulty']; +} + if (empty($cond)) { $cond = '1'; } @@ -189,9 +191,7 @@ $header .= '