@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | //writing database |
| 39 | 39 | $this->transactionDB(); |
| 40 | 40 | |
| 41 | - }catch(Throwable $e){ |
|
| 41 | + } catch(Throwable $e){ |
|
| 42 | 42 | if ($e->getMessage()!==""){ |
| 43 | 43 | $this->command->line("\n <bg=red;fg=white> {$e->getMessage()} </>\n"); |
| 44 | 44 | } |
@@ -220,7 +220,7 @@ discard block |
||
| 220 | 220 | |
| 221 | 221 | DB::commit(); |
| 222 | 222 | |
| 223 | - }catch(Throwable $e){ |
|
| 223 | + } catch(Throwable $e){ |
|
| 224 | 224 | DB::rollback(); |
| 225 | 225 | if ($e->getMessage()!=="") { |
| 226 | 226 | $this->command->line("\n <bg=red;fg=white> {$e->getMessage()} </>\n"); |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | } |
| 61 | 61 | if($assign_uid != 0){ |
| 62 | 62 | $assignee = $groupModel->userProfile($assign_uid,$contest_detail['gid']); |
| 63 | - }else{ |
|
| 63 | + } else{ |
|
| 64 | 64 | $assignee = null; |
| 65 | 65 | } |
| 66 | 66 | $ret = [ |
@@ -220,7 +220,7 @@ discard block |
||
| 220 | 220 | } |
| 221 | 221 | $contestModel->contestUpdate($cid,$all_data,$problemSet); |
| 222 | 222 | return ResponseModel::success(200); |
| 223 | - }else{ |
|
| 223 | + } else{ |
|
| 224 | 224 | $allow_update = ['name','description']; |
| 225 | 225 | |
| 226 | 226 | foreach($all_data as $key => $value){ |
@@ -58,7 +58,7 @@ |
||
| 58 | 58 | $account=$contestModel->getContestAccount($cid); |
| 59 | 59 | if($account==null){ |
| 60 | 60 | return ; |
| 61 | - }else{ |
|
| 61 | + } else{ |
|
| 62 | 62 | $AccountExport=new AccountExport($account); |
| 63 | 63 | $filename="ContestAccount$cid"; |
| 64 | 64 | return Excel::download($AccountExport, $filename.'.xlsx'); |
@@ -43,7 +43,9 @@ discard block |
||
| 43 | 43 | { |
| 44 | 44 | $groupModel=new GroupModel(); |
| 45 | 45 | $basic_info=$groupModel->details($gcode); |
| 46 | - if(empty($basic_info)) return Redirect::route('group.index'); |
|
| 46 | + if(empty($basic_info)) { |
|
| 47 | + return Redirect::route('group.index'); |
|
| 48 | + } |
|
| 47 | 49 | $clearance=$groupModel->judgeClearance($basic_info["gid"], Auth::user()->id); |
| 48 | 50 | $member_list=$groupModel->userList($basic_info["gid"]); |
| 49 | 51 | return view('group.settings.general', [ |
@@ -85,7 +87,9 @@ discard block |
||
| 85 | 87 | { |
| 86 | 88 | $groupModel=new GroupModel(); |
| 87 | 89 | $basic_info=$groupModel->details($gcode); |
| 88 | - if(empty($basic_info)) return Redirect::route('group.index'); |
|
| 90 | + if(empty($basic_info)) { |
|
| 91 | + return Redirect::route('group.index'); |
|
| 92 | + } |
|
| 89 | 93 | return view('group.settings.danger', [ |
| 90 | 94 | 'page_title'=>"Group Setting danger", |
| 91 | 95 | 'site_title'=>config("app.name"), |
@@ -104,7 +108,9 @@ discard block |
||
| 104 | 108 | $groupModel=new GroupModel(); |
| 105 | 109 | $contestModel=new ContestModel(); |
| 106 | 110 | $basic_info=$groupModel->details($gcode); |
| 107 | - if(empty($basic_info)) return Redirect::route('group.index'); |
|
| 111 | + if(empty($basic_info)) { |
|
| 112 | + return Redirect::route('group.index'); |
|
| 113 | + } |
|
| 108 | 114 | $clearance=$groupModel->judgeClearance($basic_info["gid"], Auth::user()->id); |
| 109 | 115 | $member_list=$groupModel->userList($basic_info["gid"]); |
| 110 | 116 | $group_notice=$groupModel->detailNotice($gcode); |
@@ -124,7 +130,9 @@ discard block |
||
| 124 | 130 | $groupModel=new GroupModel(); |
| 125 | 131 | $contestModel=new ContestModel(); |
| 126 | 132 | $basic_info=$groupModel->details($gcode); |
| 127 | - if(empty($basic_info)) return Redirect::route('group.index'); |
|
| 133 | + if(empty($basic_info)) { |
|
| 134 | + return Redirect::route('group.index'); |
|
| 135 | + } |
|
| 128 | 136 | $clearance=$groupModel->judgeClearance($basic_info["gid"], Auth::user()->id); |
| 129 | 137 | $contest_list=$contestModel->listForSetting($basic_info["gid"]); |
| 130 | 138 | $member_list=$groupModel->userList($basic_info["gid"]); |
@@ -69,9 +69,13 @@ |
||
| 69 | 69 | $all_data=$request->all(); |
| 70 | 70 | |
| 71 | 71 | $groupModel=new GroupModel(); |
| 72 | - if($all_data["gcode"]=="create") return ResponseModel::err(7005); |
|
| 72 | + if($all_data["gcode"]=="create") { |
|
| 73 | + return ResponseModel::err(7005); |
|
| 74 | + } |
|
| 73 | 75 | $is_group=$groupModel->isGroup($all_data["gcode"]); |
| 74 | - if($is_group) return ResponseModel::err(7006); |
|
| 76 | + if($is_group) { |
|
| 77 | + return ResponseModel::err(7006); |
|
| 78 | + } |
|
| 75 | 79 | |
| 76 | 80 | $allow_extension=['jpg', 'png', 'jpeg', 'gif', 'bmp']; |
| 77 | 81 | if (!empty($request->file('img')) && $request->file('img')->isValid()) { |
@@ -225,7 +225,7 @@ discard block |
||
| 225 | 225 | $paginator=$paginator->where(["practice"=>$filter['practice']]); |
| 226 | 226 | } |
| 227 | 227 | $paginator = $paginator ->paginate(10); |
| 228 | - }elseif($filter['public']=='0'){ |
|
| 228 | + } elseif($filter['public']=='0'){ |
|
| 229 | 229 | $paginator=DB::table('group_member') |
| 230 | 230 | ->groupBy('contest.cid') |
| 231 | 231 | ->select('contest.*') |
@@ -255,7 +255,7 @@ discard block |
||
| 255 | 255 | ) |
| 256 | 256 | ->orderBy('contest.begin_time', 'desc') |
| 257 | 257 | ->paginate(10); |
| 258 | - }else{ |
|
| 258 | + } else{ |
|
| 259 | 259 | $paginator=DB::table('group_member') |
| 260 | 260 | ->groupBy('contest.cid') |
| 261 | 261 | ->select('contest.*') |
@@ -798,13 +798,13 @@ discard block |
||
| 798 | 798 | if(time() < $end_time){ |
| 799 | 799 | if($clearance == 3){ |
| 800 | 800 | $contestRankRaw=Cache::tags(['contest', 'rank'])->get("contestAdmin$cid"); |
| 801 | - }else{ |
|
| 801 | + } else{ |
|
| 802 | 802 | $contestRankRaw=Cache::tags(['contest', 'rank'])->get($cid); |
| 803 | 803 | } |
| 804 | 804 | if(!isset($contestRankRaw)){ |
| 805 | 805 | $contestRankRaw=$this->contestRankCache($cid); |
| 806 | 806 | } |
| 807 | - }else{ |
|
| 807 | + } else{ |
|
| 808 | 808 | if($clearance == 3){ |
| 809 | 809 | $contestRankRaw=Cache::tags(['contest', 'rank'])->get("contestAdmin$cid"); |
| 810 | 810 | if (!isset($contestRankRaw)) { |
@@ -814,7 +814,7 @@ discard block |
||
| 814 | 814 | $this->storeContestRankInMySQL($cid, $contestRankRaw); |
| 815 | 815 | } |
| 816 | 816 | } |
| 817 | - }else{ |
|
| 817 | + } else{ |
|
| 818 | 818 | $contestRankRaw=$this->getContestRankFromMySQL($cid); |
| 819 | 819 | if(!isset($contestRankRaw)){ |
| 820 | 820 | $contestRankRaw=Cache::tags(['contest', 'rank'])->get($cid); |
@@ -899,7 +899,7 @@ discard block |
||
| 899 | 899 | return DB::table("contest_clarification")->where([ |
| 900 | 900 | "cid"=>$cid |
| 901 | 901 | ])->orderBy('create_time', 'desc')->get()->all(); |
| 902 | - }else{ |
|
| 902 | + } else{ |
|
| 903 | 903 | return DB::table("contest_clarification")->where([ |
| 904 | 904 | "cid"=>$cid |
| 905 | 905 | ])->where(function ($query) { |
@@ -1063,7 +1063,7 @@ discard block |
||
| 1063 | 1063 | $filter['pid'] = array_search($filter['ncode'], array_column($problemSet_temp, 'ncode')); |
| 1064 | 1064 | if($filter['pid']==false){ |
| 1065 | 1065 | $filter['pid'] = null; |
| 1066 | - }else{ |
|
| 1066 | + } else{ |
|
| 1067 | 1067 | $filter['pid'] = $problemSet_temp[$filter['pid']]['pid']; |
| 1068 | 1068 | } |
| 1069 | 1069 | |
@@ -1171,7 +1171,7 @@ discard block |
||
| 1171 | 1171 | "records"=>[] |
| 1172 | 1172 | ]; |
| 1173 | 1173 | } |
| 1174 | - }else{ |
|
| 1174 | + } else{ |
|
| 1175 | 1175 | if ($basicInfo["status_visibility"]==2) { |
| 1176 | 1176 | // View all |
| 1177 | 1177 | $paginator=DB::table("submission")->where([ |
@@ -1421,7 +1421,7 @@ discard block |
||
| 1421 | 1421 | if($ratingCalculator->calculate()){ |
| 1422 | 1422 | $ratingCalculator->storage(); |
| 1423 | 1423 | return true; |
| 1424 | - }else{ |
|
| 1424 | + } else{ |
|
| 1425 | 1425 | return false; |
| 1426 | 1426 | } |
| 1427 | 1427 | } else { |
@@ -1470,7 +1470,7 @@ discard block |
||
| 1470 | 1470 | $contestRankRaw = $this->contestRankCache($cid); |
| 1471 | 1471 | Cache::tags(['contest', 'rank'])->put($cid, $contestRankRaw); |
| 1472 | 1472 | Cache::tags(['contest', 'rank'])->put("contestAdmin$cid", $contestRankRaw); |
| 1473 | - }else{ |
|
| 1473 | + } else{ |
|
| 1474 | 1474 | DB::table($this->tableName) |
| 1475 | 1475 | ->where('cid',$cid) |
| 1476 | 1476 | ->update($data); |
@@ -1572,8 +1572,7 @@ discard block |
||
| 1572 | 1572 | if(time() > $chache['end_time']){ |
| 1573 | 1573 | $this->storeContestRankInMySQL($cid, $ret); |
| 1574 | 1574 | } |
| 1575 | - } |
|
| 1576 | - else{ |
|
| 1575 | + } else{ |
|
| 1577 | 1576 | $ret=[]; |
| 1578 | 1577 | $chache=[]; |
| 1579 | 1578 | $chache['contest_info']=DB::table("contest")->where("cid", $cid)->first(); |
@@ -1588,7 +1587,7 @@ discard block |
||
| 1588 | 1587 | "cid"=>$cid, |
| 1589 | 1588 | "audit"=>1 |
| 1590 | 1589 | ])->select('uid')->get()->all(); |
| 1591 | - }else{ |
|
| 1590 | + } else{ |
|
| 1592 | 1591 | $submissionUsers=DB::table("submission")->where([ |
| 1593 | 1592 | "cid"=>$cid |
| 1594 | 1593 | ])->where( |
@@ -1623,9 +1622,9 @@ discard block |
||
| 1623 | 1622 | Cache::tags(['contest', 'rank'])->put("contestAdmin$cid", $retAdmin); |
| 1624 | 1623 | } |
| 1625 | 1624 | } |
| 1626 | - }catch(LockTimeoutException $e){ |
|
| 1625 | + } catch(LockTimeoutException $e){ |
|
| 1627 | 1626 | Log::warning("Contest Rank Lock Timed Out"); |
| 1628 | - }finally{ |
|
| 1627 | + } finally{ |
|
| 1629 | 1628 | optional($lock)->release(); |
| 1630 | 1629 | } |
| 1631 | 1630 | } |
@@ -1648,7 +1647,7 @@ discard block |
||
| 1648 | 1647 | return 1; |
| 1649 | 1648 | } |
| 1650 | 1649 | }); |
| 1651 | - }else if ($contest_info["rule"]==2){ |
|
| 1650 | + } else if ($contest_info["rule"]==2){ |
|
| 1652 | 1651 | usort($ret, function ($a, $b) { |
| 1653 | 1652 | if ($a["score"]==$b["score"]) { |
| 1654 | 1653 | if ($a["solved"]==$b["solved"]) { |
@@ -1672,8 +1671,9 @@ discard block |
||
| 1672 | 1671 | { |
| 1673 | 1672 | $id = count($ret); |
| 1674 | 1673 | foreach($ret as $key => $r){ |
| 1675 | - if($r['uid'] == $uid) |
|
| 1676 | - $id = $key; |
|
| 1674 | + if($r['uid'] == $uid) { |
|
| 1675 | + $id = $key; |
|
| 1676 | + } |
|
| 1677 | 1677 | } |
| 1678 | 1678 | if ($contest_info["rule"]==1) { |
| 1679 | 1679 | // ACM/ICPC Mode |
@@ -1681,7 +1681,7 @@ discard block |
||
| 1681 | 1681 | $prob_detail = []; |
| 1682 | 1682 | $totPen = 0; |
| 1683 | 1683 | $totScore = 0; |
| 1684 | - }else{ |
|
| 1684 | + } else{ |
|
| 1685 | 1685 | $prob_detail = $ret[$id]['problem_detail']; |
| 1686 | 1686 | $totPen=$ret[$id]['penalty']; |
| 1687 | 1687 | $totScore=$ret[$id]['score']; |
@@ -1736,7 +1736,7 @@ discard block |
||
| 1736 | 1736 | $prob_detail = []; |
| 1737 | 1737 | $totSolved = 0; |
| 1738 | 1738 | $totScore = 0; |
| 1739 | - }else{ |
|
| 1739 | + } else{ |
|
| 1740 | 1740 | $prob_detail = $ret[$id]['problem_detail']; |
| 1741 | 1741 | $totSolved=$ret[$id]['solved']; |
| 1742 | 1742 | $totScore=$ret[$id]['score']; |
@@ -1799,18 +1799,18 @@ discard block |
||
| 1799 | 1799 | return false; |
| 1800 | 1800 | } |
| 1801 | 1801 | return true; |
| 1802 | - }else if($status === 0){ |
|
| 1802 | + } else if($status === 0){ |
|
| 1803 | 1803 | if($begin_time_new !== null){ |
| 1804 | 1804 | return false; |
| 1805 | 1805 | } |
| 1806 | 1806 | if($end_time_new !== null){ |
| 1807 | 1807 | if(strtotime($end_time_new) <= time()){ |
| 1808 | 1808 | return false; |
| 1809 | - }else{ |
|
| 1809 | + } else{ |
|
| 1810 | 1810 | return true; |
| 1811 | 1811 | } |
| 1812 | 1812 | } |
| 1813 | - }else{ |
|
| 1813 | + } else{ |
|
| 1814 | 1814 | return false; |
| 1815 | 1815 | } |
| 1816 | 1816 | |
@@ -1831,8 +1831,7 @@ discard block |
||
| 1831 | 1831 | return DB::table("contest_clarification")->where('ccid','=',$ccid)->update([ |
| 1832 | 1832 | "public"=>1 |
| 1833 | 1833 | ]); |
| 1834 | - } |
|
| 1835 | - else |
|
| 1834 | + } else |
|
| 1836 | 1835 | { |
| 1837 | 1836 | return DB::table("contest_clarification")->where('ccid','=',$ccid)->update([ |
| 1838 | 1837 | "public"=>0 |
@@ -1855,7 +1854,7 @@ discard block |
||
| 1855 | 1854 | ->whereIn('pid',array_column($contestRank[0]['problem_detail'],'pid')) |
| 1856 | 1855 | ->select('pid','title') |
| 1857 | 1856 | ->get()->all(); |
| 1858 | - }else{ |
|
| 1857 | + } else{ |
|
| 1859 | 1858 | $all_problems = []; |
| 1860 | 1859 | } |
| 1861 | 1860 | $tags = DB::table('group_problem_tag') |
@@ -1920,7 +1919,7 @@ discard block |
||
| 1920 | 1919 | return [ |
| 1921 | 1920 | 'result' => true |
| 1922 | 1921 | ]; |
| 1923 | - }else{ |
|
| 1922 | + } else{ |
|
| 1924 | 1923 | return [ |
| 1925 | 1924 | 'result' => false, |
| 1926 | 1925 | 'sid' => $submissions |
@@ -115,7 +115,9 @@ discard block |
||
| 115 | 115 | public function details($gcode) |
| 116 | 116 | { |
| 117 | 117 | $basic_info=DB::table($this->tableName)->where(["gcode"=>$gcode])->first(); |
| 118 | - if(empty($basic_info)) return []; |
|
| 118 | + if(empty($basic_info)) { |
|
| 119 | + return []; |
|
| 120 | + } |
|
| 119 | 121 | $basic_info["members"]=$this->countGroupMembers($basic_info["gid"]); |
| 120 | 122 | $basic_info["tags"]=$this->getGroupTags($basic_info["gid"]); |
| 121 | 123 | $basic_info["create_time_foramt"]=date_format(date_create($basic_info["create_time"]), 'M jS, Y'); |
@@ -163,7 +165,9 @@ discard block |
||
| 163 | 165 | foreach ($user_list as &$u) { |
| 164 | 166 | $u["role_parsed"]=$this->role[$u["role"]]; |
| 165 | 167 | $u["role_color"]=$this->role_color[$u["role"]]; |
| 166 | - if(is_null($u["sub_group"])) $u["sub_group"]="None"; |
|
| 168 | + if(is_null($u["sub_group"])) { |
|
| 169 | + $u["sub_group"]="None"; |
|
| 170 | + } |
|
| 167 | 171 | } |
| 168 | 172 | return $user_list; |
| 169 | 173 | } |
@@ -232,7 +236,7 @@ discard block |
||
| 232 | 236 | ->where('gid',$gid) |
| 233 | 237 | ->distinct() |
| 234 | 238 | ->get()->all(); |
| 235 | - }else{ |
|
| 239 | + } else{ |
|
| 236 | 240 | $tags = DB::table('group_problem_tag') |
| 237 | 241 | ->select('tag') |
| 238 | 242 | ->where('gid', $gid) |
@@ -266,7 +270,7 @@ discard block |
||
| 266 | 270 | foreach($problems as $key => $value){ |
| 267 | 271 | if($contestModel->judgeClearance($value['cid'],$user_id) != 3){ |
| 268 | 272 | unset($problems[$key]); |
| 269 | - }else{ |
|
| 273 | + } else{ |
|
| 270 | 274 | $problems[$key]['tags'] = $this->problemTags($gid,$value['pid']); |
| 271 | 275 | } |
| 272 | 276 | } |
@@ -327,7 +331,9 @@ discard block |
||
| 327 | 331 | public function judgeEmailClearance($gid, $email) |
| 328 | 332 | { |
| 329 | 333 | $user=DB::table("users")->where(["email"=>$email])->first(); |
| 330 | - if(empty($user)) return -4; |
|
| 334 | + if(empty($user)) { |
|
| 335 | + return -4; |
|
| 336 | + } |
|
| 331 | 337 | $ret=DB::table("group_member")->where([ |
| 332 | 338 | "gid"=>$gid, |
| 333 | 339 | "uid"=>$user["id"], |
@@ -461,7 +467,7 @@ discard block |
||
| 461 | 467 | if(!empty($last_cr)){ |
| 462 | 468 | if($cr['solved'] == $last_cr['solved'] && $cr['penalty'] == $last_cr['penalty'] ){ |
| 463 | 469 | $rank = $last_rank; |
| 464 | - }else{ |
|
| 470 | + } else{ |
|
| 465 | 471 | $rank = $index; |
| 466 | 472 | $last_rank = $rank; |
| 467 | 473 | } |
@@ -613,7 +619,7 @@ discard block |
||
| 613 | 619 | 'cid' => $contest['cid'], |
| 614 | 620 | 'name' => $contest['name'] |
| 615 | 621 | ]; |
| 616 | - }else{ |
|
| 622 | + } else{ |
|
| 617 | 623 | $result[] = [ |
| 618 | 624 | 'ret' => 'judging', |
| 619 | 625 | 'cid' => $contest['cid'], |
@@ -43,7 +43,9 @@ discard block |
||
| 43 | 43 | $groupModel=new GroupModel(); |
| 44 | 44 | $contestModel=new ContestModel(); |
| 45 | 45 | $basic_info=$groupModel->details($gcode); |
| 46 | - if(empty($basic_info)) return Redirect::route('group.index'); |
|
| 46 | + if(empty($basic_info)) { |
|
| 47 | + return Redirect::route('group.index'); |
|
| 48 | + } |
|
| 47 | 49 | $my_profile=$groupModel->userProfile(Auth::user()->id, $basic_info["gid"]); |
| 48 | 50 | $clearance=$groupModel->judgeClearance($basic_info["gid"], Auth::user()->id); |
| 49 | 51 | $member_list=$groupModel->userList($basic_info["gid"]); |
@@ -89,9 +91,13 @@ discard block |
||
| 89 | 91 | public function analysis($gcode){ |
| 90 | 92 | $groupModel = new GroupModel(); |
| 91 | 93 | $basic_info=$groupModel->details($gcode); |
| 92 | - if(empty($basic_info)) return Redirect::route('group.index'); |
|
| 94 | + if(empty($basic_info)) { |
|
| 95 | + return Redirect::route('group.index'); |
|
| 96 | + } |
|
| 93 | 97 | $clearance=$groupModel->judgeClearance($basic_info["gid"], Auth::user()->id); |
| 94 | - if($clearance < 1) return Redirect::route('group.detail',['gcode' => $gcode]); |
|
| 98 | + if($clearance < 1) { |
|
| 99 | + return Redirect::route('group.detail',['gcode' => $gcode]); |
|
| 100 | + } |
|
| 95 | 101 | $group_info = $groupModel->details($gcode); |
| 96 | 102 | return view('group.settings.analysis', [ |
| 97 | 103 | 'page_title'=>"Group Analysis", |
@@ -123,7 +129,7 @@ discard block |
||
| 123 | 129 | ), |
| 124 | 130 | $gcode . '_Group_Contest_Analysis.xlsx' |
| 125 | 131 | ); |
| 126 | - }else{ |
|
| 132 | + } else{ |
|
| 127 | 133 | $data = $groupModel->groupMemberPracticeTagStat($group_info['gid']); |
| 128 | 134 | return Excel::download( |
| 129 | 135 | new GroupAnalysisExport( |
@@ -65,12 +65,12 @@ |
||
| 65 | 65 | foreach ($ret as $gid => $group) { |
| 66 | 66 | if(empty($group['result'])){ |
| 67 | 67 | Log::channel('group_elo')->info('Refreshed Group Elo (Empty) : ('.$gid.')'.$group['name']); |
| 68 | - }else{ |
|
| 68 | + } else{ |
|
| 69 | 69 | Log::channel('group_elo')->info('Refreshing Group Elo: ('.$gid.')'.$group['name']); |
| 70 | 70 | foreach ($group['result'] as $contest) { |
| 71 | 71 | if($contest['ret'] == 'success'){ |
| 72 | 72 | Log::channel('group_elo')->info(' Elo Clac Successfully : ('.$contest['cid'].')'.$contest['name']); |
| 73 | - }else{ |
|
| 73 | + } else{ |
|
| 74 | 74 | Log::channel('group_elo')->info(' Elo Clac Faild (Judge Not Over) : ('.$contest['cid'].')'.$contest['name'].' sids:'); |
| 75 | 75 | foreach ($contest['submissions'] as $sid) { |
| 76 | 76 | Log::channel('group_elo')->info(' '.$sid['sid']); |