Passed
Branch dev (6ac00b)
by John
04:53
created
app/Http/Controllers/Contest/AdminController.php 2 patches
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
         $contestModel=new ContestModel();
25 25
         $verified=$contestModel->isVerified($cid);
26 26
         $clearance=$contestModel->judgeClearance($cid, Auth::user()->id);
27
-        if ($clearance <= 2) {
27
+        if ($clearance<=2) {
28 28
             return Redirect::route('contest_detail', ['cid' => $cid]);
29 29
         }
30 30
         $contest_name=$contestModel->contestName($cid);
@@ -52,30 +52,30 @@  discard block
 block discarded – undo
52 52
     {
53 53
         $contestModel=new ContestModel();
54 54
         $clearance=$contestModel->judgeClearance($cid, Auth::user()->id);
55
-        if ($clearance <= 2) {
55
+        if ($clearance<=2) {
56 56
             return Redirect::route('contest_detail', ['cid' => $cid]);
57 57
         }
58 58
         $account=$contestModel->getContestAccount($cid);
59
-        if($account==null){
60
-            return ;
61
-        }else{
59
+        if ($account==null) {
60
+            return;
61
+        } else {
62 62
             $AccountExport=new AccountExport($account);
63 63
             $filename="ContestAccount$cid";
64 64
             return Excel::download($AccountExport, $filename.'.xlsx');
65 65
         }
66 66
     }
67 67
 
68
-    public function refreshContestRank($cid){
68
+    public function refreshContestRank($cid) {
69 69
         $contestModel=new ContestModel();
70 70
         $clearance=$contestModel->judgeClearance($cid, Auth::user()->id);
71
-        if ($clearance <= 2) {
71
+        if ($clearance<=2) {
72 72
             return Redirect::route('contest.detail', ['cid' => $cid]);
73 73
         }
74 74
         $contestRankRaw=$contestModel->contestRankCache($cid);
75 75
         Cache::tags(['contest', 'rank'])->put($cid, $contestRankRaw);
76 76
         Cache::tags(['contest', 'rank'])->put("contestAdmin$cid", $contestRankRaw);
77 77
         $end_time=strtotime(DB::table("contest")->where(["cid"=>$cid])->select("end_time")->first()["end_time"]);
78
-        if(time() > $end_time){
78
+        if (time()>$end_time) {
79 79
             $contestModel->storeContestRankInMySQL($cid, $contestRankRaw);
80 80
         }
81 81
         return Redirect::route('contest.rank', ['cid' => $cid]);
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -58,7 +58,7 @@
 block discarded – undo
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');
Please login to merge, or discard this patch.
app/Http/Controllers/Contest/IndexController.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@
 block discarded – undo
27 27
         $filter["rated"]=isset($all_data["rated"]) ? $all_data["rated"] : null;
28 28
         $filter["anticheated"]=isset($all_data["anticheated"]) ? $all_data["anticheated"] : null;
29 29
         $filter["practice"]=isset($all_data["practice"]) ? $all_data["practice"] : null;
30
-        $return_list=$contestModel->list($filter,Auth::check()?Auth::user()->id:0);
30
+        $return_list=$contestModel->list($filter, Auth::check() ?Auth::user()->id : 0);
31 31
         $featured=$contestModel->featured();
32 32
         if (is_null($return_list)) {
33 33
             if (isset($all_data["page"]) && $all_data["page"]>1) {
Please login to merge, or discard this patch.
app/Http/Controllers/Contest/BoardController.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -106,8 +106,8 @@  discard block
 block discarded – undo
106 106
             ];
107 107
         }
108 108
 
109
-        $editor_left_width = $accountModel->getExtra(Auth::user()->id, 'editor_left_width');
110
-        if(empty($editor_left_width)) $editor_left_width='40';
109
+        $editor_left_width=$accountModel->getExtra(Auth::user()->id, 'editor_left_width');
110
+        if (empty($editor_left_width)) $editor_left_width='40';
111 111
 
112 112
         return view('contest.board.editor', [
113 113
             'page_title'=>"Problem Detail",
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
         ]);
266 266
     }
267 267
 
268
-    public function analysis($cid){
268
+    public function analysis($cid) {
269 269
         $contestModel=new ContestModel();
270 270
         $clearance=$contestModel->judgeClearance($cid, Auth::user()->id);
271 271
         if (!$clearance) {
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -107,7 +107,9 @@
 block discarded – undo
107 107
         }
108 108
 
109 109
         $editor_left_width = $accountModel->getExtra(Auth::user()->id, 'editor_left_width');
110
-        if(empty($editor_left_width)) $editor_left_width='40';
110
+        if(empty($editor_left_width)) {
111
+            $editor_left_width='40';
112
+        }
111 113
 
112 114
         return view('contest.board.editor', [
113 115
             'page_title'=>"Problem Detail",
Please login to merge, or discard this patch.
app/Babel/Install/InstallerWorker.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -84,9 +84,9 @@
 block discarded – undo
84 84
             $installed_timestamp=intval($info["compiler_timestamp"]);
85 85
         }
86 86
         $latest_timestamp=$installed_timestamp;
87
-        $ConpilerConfig = glob(babel_path("Extension/$ocode/compiler/*.*"));
87
+        $ConpilerConfig=glob(babel_path("Extension/$ocode/compiler/*.*"));
88 88
         foreach ($ConpilerConfig as $file) {
89
-            if (intval(basename($file)) > $installed_timestamp) {
89
+            if (intval(basename($file))>$installed_timestamp) {
90 90
                 try {
91 91
                     $this->commitCompiler($file, json_decode(file_get_contents($file), true));
92 92
                     $latest_timestamp=intval(basename($file));
Please login to merge, or discard this patch.
app/Models/Submission/SubmissionModel.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -413,7 +413,7 @@  discard block
 block discarded – undo
413 413
                                             ->where(['verdict'=>'Waiting'])
414 414
                                             ->get()
415 415
                                             ->all();
416
-        foreach($ret as &$r){
416
+        foreach ($ret as &$r) {
417 417
             $r["ocode"]=DB::table("oj")->where(["oid"=>$r["oid"]])->first()["ocode"];
418 418
         }
419 419
         return $ret;
@@ -431,15 +431,15 @@  discard block
 block discarded – undo
431 431
         if (isset($sub['verdict'])) {
432 432
             $sub["color"]=$this->colorScheme[$sub['verdict']];
433 433
         }
434
-        $result = DB::table($this->tableName)->where(['sid'=>$sid])->update($sub);
435
-        $contestModel = new ContestModel();
436
-        $submission_info = DB::table($this->tableName) -> where(['sid'=>$sid]) -> get() -> first();
437
-        if ($result==1 && $submission_info['cid'] && $contestModel->isContestRunning($submission_info['cid'])){
438
-            $sub['pid'] = $submission_info['pid'];
439
-            $sub['uid'] = $submission_info['uid'];
440
-            $sub['cid'] = $submission_info['cid'];
441
-            $sub['sid'] = $sid;
442
-            $contestModel->updateContestRankTable($submission_info['cid'],$sub);
434
+        $result=DB::table($this->tableName)->where(['sid'=>$sid])->update($sub);
435
+        $contestModel=new ContestModel();
436
+        $submission_info=DB::table($this->tableName) -> where(['sid'=>$sid]) -> get() -> first();
437
+        if ($result==1 && $submission_info['cid'] && $contestModel->isContestRunning($submission_info['cid'])) {
438
+            $sub['pid']=$submission_info['pid'];
439
+            $sub['uid']=$submission_info['uid'];
440
+            $sub['cid']=$submission_info['cid'];
441
+            $sub['sid']=$sid;
442
+            $contestModel->updateContestRankTable($submission_info['cid'], $sub);
443 443
         }
444 444
         return $result;
445 445
     }
@@ -510,15 +510,15 @@  discard block
 block discarded – undo
510 510
             'desc'
511 511
         );
512 512
 
513
-        if($filter["pcode"]){
513
+        if ($filter["pcode"]) {
514 514
             $paginator=$paginator->where(["pcode"=>$filter["pcode"]]);
515 515
         }
516 516
 
517
-        if($filter["result"]){
517
+        if ($filter["result"]) {
518 518
             $paginator=$paginator->where(["verdict"=>$filter["result"]]);
519 519
         }
520 520
 
521
-        if($filter["account"]){
521
+        if ($filter["account"]) {
522 522
             $paginator=$paginator->where(["name"=>$filter["account"]]);
523 523
         }
524 524
 
Please login to merge, or discard this patch.
app/Http/Controllers/Group/IndexController.php 2 patches
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
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)) return Redirect::route('group.index');
47 47
         $my_profile=$groupModel->userProfile(Auth::user()->id, $basic_info["gid"]);
48 48
         $clearance=$groupModel->judgeClearance($basic_info["gid"], Auth::user()->id);
49 49
         $member_list=$groupModel->userList($basic_info["gid"]);
@@ -86,9 +86,9 @@  discard block
 block discarded – undo
86 86
      *
87 87
      * @return Response
88 88
      */
89
-    public function analysis($gcode){
90
-        $groupModel = new GroupModel();
91
-        $group_info = $groupModel->details($gcode);
89
+    public function analysis($gcode) {
90
+        $groupModel=new GroupModel();
91
+        $group_info=$groupModel->details($gcode);
92 92
         return view('group.settings.analysis', [
93 93
             'page_title'=>"Group Analysis",
94 94
             'site_title'=>"NOJ",
@@ -98,13 +98,13 @@  discard block
 block discarded – undo
98 98
         ]);
99 99
     }
100 100
 
101
-    public function analysisDownload($gcode,Request $request){
102
-        $all_data = $request->all();
103
-        $groupModel = new GroupModel();
104
-        $group_info = $groupModel->details($gcode);
105
-        $mode = $all_data['mode'] ?? 'contest';
106
-        if($mode == 'contest'){
107
-            $data = $groupModel->groupMemberPracticeContestStat($group_info['gid']);
101
+    public function analysisDownload($gcode, Request $request) {
102
+        $all_data=$request->all();
103
+        $groupModel=new GroupModel();
104
+        $group_info=$groupModel->details($gcode);
105
+        $mode=$all_data['mode'] ?? 'contest';
106
+        if ($mode=='contest') {
107
+            $data=$groupModel->groupMemberPracticeContestStat($group_info['gid']);
108 108
             return Excel::download(
109 109
                 new GroupAnalysisExport(
110 110
                     [
@@ -117,10 +117,10 @@  discard block
 block discarded – undo
117 117
                         'percent' => $all_data['percent'] ?? false,
118 118
                     ]
119 119
                 ),
120
-                $gcode . '_Group_Contest_Analysis.xlsx'
120
+                $gcode.'_Group_Contest_Analysis.xlsx'
121 121
             );
122
-        }else{
123
-            $data = $groupModel->groupMemberPracticeTagStat($group_info['gid']);
122
+        } else {
123
+            $data=$groupModel->groupMemberPracticeTagStat($group_info['gid']);
124 124
             return Excel::download(
125 125
                 new GroupAnalysisExport(
126 126
                     [
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
                         'percent' => $all_data['percent'] ?? false,
134 134
                     ]
135 135
                 ),
136
-                $gcode . '_Group_Tag_Analysis.xlsx'
136
+                $gcode.'_Group_Tag_Analysis.xlsx'
137 137
             );
138 138
         }
139 139
     }
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -43,7 +43,9 @@  discard block
 block discarded – undo
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"]);
@@ -119,7 +121,7 @@  discard block
 block discarded – undo
119 121
                 ),
120 122
                 $gcode . '_Group_Contest_Analysis.xlsx'
121 123
             );
122
-        }else{
124
+        } else{
123 125
             $data = $groupModel->groupMemberPracticeTagStat($group_info['gid']);
124 126
             return Excel::download(
125 127
                 new GroupAnalysisExport(
Please login to merge, or discard this patch.
app/Http/Controllers/Group/AdminController.php 2 patches
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
      */
22 22
     public function settings($gcode)
23 23
     {
24
-        return Redirect::route('group.settings.general', ['gcode' => $gcode]);;
24
+        return Redirect::route('group.settings.general', ['gcode' => $gcode]); ;
25 25
     }
26 26
 
27 27
     /**
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
      */
32 32
     public function settingsReturn($gcode)
33 33
     {
34
-        return Redirect::route('group.detail', ['gcode' => $gcode]);;
34
+        return Redirect::route('group.detail', ['gcode' => $gcode]); ;
35 35
     }
36 36
 
37 37
     /**
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
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)) return Redirect::route('group.index');
47 47
         $clearance=$groupModel->judgeClearance($basic_info["gid"], Auth::user()->id);
48 48
         $member_list=$groupModel->userList($basic_info["gid"]);
49 49
         return view('group.settings.general', [
@@ -61,10 +61,10 @@  discard block
 block discarded – undo
61 61
      *
62 62
      * @return Response
63 63
      */
64
-    public function problems($gcode){
65
-        $groupModel = new GroupModel();
66
-        $group_info = $groupModel->details($gcode);
67
-        $problems = $groupModel->problems($group_info['gid']);
64
+    public function problems($gcode) {
65
+        $groupModel=new GroupModel();
66
+        $group_info=$groupModel->details($gcode);
67
+        $problems=$groupModel->problems($group_info['gid']);
68 68
         $basic_info=$groupModel->details($gcode);
69 69
         return view('group.settings.problems', [
70 70
             'page_title'=>"Group Problems",
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
     {
86 86
         $groupModel=new GroupModel();
87 87
         $basic_info=$groupModel->details($gcode);
88
-        if(empty($basic_info)) return Redirect::route('group.index');
88
+        if (empty($basic_info)) return Redirect::route('group.index');
89 89
         return view('group.settings.danger', [
90 90
             'page_title'=>"Group Setting danger",
91 91
             'site_title'=>config("app.name"),
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
         $groupModel=new GroupModel();
105 105
         $contestModel=new ContestModel();
106 106
         $basic_info=$groupModel->details($gcode);
107
-        if(empty($basic_info)) return Redirect::route('group.index');
107
+        if (empty($basic_info)) return Redirect::route('group.index');
108 108
         $clearance=$groupModel->judgeClearance($basic_info["gid"], Auth::user()->id);
109 109
         $member_list=$groupModel->userList($basic_info["gid"]);
110 110
         $group_notice=$groupModel->detailNotice($gcode);
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
         $groupModel=new GroupModel();
125 125
         $contestModel=new ContestModel();
126 126
         $basic_info=$groupModel->details($gcode);
127
-        if(empty($basic_info)) return Redirect::route('group.index');
127
+        if (empty($basic_info)) return Redirect::route('group.index');
128 128
         $clearance=$groupModel->judgeClearance($basic_info["gid"], Auth::user()->id);
129 129
         $contest_list=$contestModel->listForSetting($basic_info["gid"]);
130 130
         $member_list=$groupModel->userList($basic_info["gid"]);
Please login to merge, or discard this patch.
Braces   +12 added lines, -4 removed lines patch added patch discarded remove patch
@@ -43,7 +43,9 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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"]);
Please login to merge, or discard this patch.