diff --git a/web/app/models/UOJContest.php b/web/app/models/UOJContest.php index 2fd0ad7..e7496d9 100644 --- a/web/app/models/UOJContest.php +++ b/web/app/models/UOJContest.php @@ -17,15 +17,15 @@ class UOJContest { return new UOJContest($info); } - public static function queryUpcomingContestIds(array $user = null, $limit = -1) { - return array_map(fn ($x) => $x['id'], DB::selectAll([ + public static function queryUpcomingContests(array $user = null, $limit = -1) { + return array_filter(array_map(fn ($x) => UOJContest::query($x['id']), DB::selectAll([ "select id from contests", "where", [ "status" => "unfinished", ], "order by start_time asc, id asc", $limit == -1 ? "" : DB::limit($limit), - ])); + ])), fn ($contest) => $contest->userCanView($user)); } public static function userCanManageSomeContest(array $user = null) { diff --git a/web/app/views/sidebar.php b/web/app/views/sidebar.php index efc7f80..956c64a 100644 --- a/web/app/views/sidebar.php +++ b/web/app/views/sidebar.php @@ -63,14 +63,13 @@ $parsedown = HTML::parsedown(); - +
近期比赛