diff --git a/challenge.php b/challenge.php index 0443f0a..69fa92a 100644 --- a/challenge.php +++ b/challenge.php @@ -10,6 +10,7 @@ /chal/list/[page] ? quest str (default) */ require_once 'function/challenge/challenge.lib.php'; +require_once 'function/common/contest.php'; function ChallengeHandle() { global $SkyOJ,$_E; diff --git a/css/third b/css/third index fca6897..fbda5f5 160000 --- a/css/third +++ b/css/third @@ -1 +1 @@ -Subproject commit fca6897f10382ad410973631d333181888f1b3db +Subproject commit fbda5f55fccdd9826c0024db14242123c328153f diff --git a/function/common/contest.php b/function/common/contest.php index dd4b7f8..83908c3 100644 --- a/function/common/contest.php +++ b/function/common/contest.php @@ -412,6 +412,9 @@ function get_all_problems_info():array $data = []; foreach( $probs as $row ) { + if(!ContestProblemStateEnum::allow($row['state'])){ + continue; + } $tmp = new ContestProblemInfo(); foreach( ContestProblemInfo::$column as $c ) { diff --git a/function/common/problem.php b/function/common/problem.php index 30f4137..d63019d 100644 --- a/function/common/problem.php +++ b/function/common/problem.php @@ -214,21 +214,24 @@ public static function uid_contest_playing_problem_set(int $uid) $tcp = \DB::tname("contest_problem"); $tcu = \DB::tname("contest_user"); $now = \SKYOJ\get_timestamp(time()); - $res = \DB::fetchAllEx(" -SELECT DISTINCT `pid` FROM `{$tcp}` - INNER JOIN `tojtest_contest` - ON `{$tcp}`.`cont_id`=`{$tc}`.`cont_id` - WHERE `{$tcp}`.`cont_id` - IN (SELECT `cont_id` FROM `{$tcu}` WHERE `uid` = ?) - AND `starttime`<= ? - AND ? <= `endtime` - ",$uid,$now,$now); + $res = \DB::fetchAllEx("SELECT `cont_id` FROM `{$tcu}` WHERE `uid` = ?",$uid); if( $res === false ) return []; $cache[$uid]=[]; - foreach($res as $row) - $cache[$uid][] = (int)$row['pid']; + foreach($res as $row){ + $cont_id = $row['cont_id']; + $contest = new \SKYOJ\Contest($cont_id); + if( $contest->isIdfail() )continue; + if( $now<$contest->starttime || $now>$contest->endtime)continue; + $probs = $contest->get_all_problems_info(); + foreach($probs as $prob){ + $pid = $prob->pid; + if(!in_array($pid,$cache[$uid])){ + $cache[$uid][] = (int)$pid; + } + } + } return $cache[$uid]; } diff --git a/js/third b/js/third index 9660dff..3a60a8a 160000 --- a/js/third +++ b/js/third @@ -1 +1 @@ -Subproject commit 9660dfff85da552f79a0882739817ea6dc60fc69 +Subproject commit 3a60a8af1cf2c62ffd3ef268e41b88c4b9f9df9f diff --git a/problem.php b/problem.php index 791f7a2..3528896 100644 --- a/problem.php +++ b/problem.php @@ -14,6 +14,7 @@ /problem/api/[method] */ require_once 'function/problem/problem.lib.php'; +require_once 'function/common/contest.php'; function ProblemHandle() { global $SkyOJ,$_E;