Passed
Branch dev (6688ef)
by John
08:01
created
app/Http/Controllers/ContestController.php 2 patches
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -187,7 +187,9 @@  discard block
 block discarded – undo
187 187
         }
188 188
 
189 189
         $editor_left_width = $accountModel->getExtra(Auth::user()->id, 'editor_left_width');
190
-        if(empty($editor_left_width)) $editor_left_width='40';
190
+        if(empty($editor_left_width)) {
191
+            $editor_left_width='40';
192
+        }
191 193
 
192 194
         return view('contest.board.editor', [
193 195
             'page_title'=>"Problem Detail",
@@ -383,7 +385,7 @@  discard block
 block discarded – undo
383 385
         $account=$contestModel->getContestAccount($cid);
384 386
         if($account==null){
385 387
             return ;
386
-        }else{
388
+        } else{
387 389
             $AccountExport=new AccountExport($account);
388 390
             $filename="ContestAccount$cid";
389 391
             return Excel::download($AccountExport, $filename.'.xlsx');
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
         $filter["rated"]=isset($all_data["rated"]) ? $all_data["rated"] : null;
35 35
         $filter["anticheated"]=isset($all_data["anticheated"]) ? $all_data["anticheated"] : null;
36 36
         $filter["practice"]=isset($all_data["practice"]) ? $all_data["practice"] : null;
37
-        $return_list=$contestModel->list($filter,Auth::check()?Auth::user()->id:0);
37
+        $return_list=$contestModel->list($filter, Auth::check() ?Auth::user()->id : 0);
38 38
         $featured=$contestModel->featured();
39 39
         if (is_null($return_list)) {
40 40
             if (isset($all_data["page"]) && $all_data["page"]>1) {
@@ -188,8 +188,8 @@  discard block
 block discarded – undo
188 188
             ];
189 189
         }
190 190
 
191
-        $editor_left_width = $accountModel->getExtra(Auth::user()->id, 'editor_left_width');
192
-        if(empty($editor_left_width)) $editor_left_width='40';
191
+        $editor_left_width=$accountModel->getExtra(Auth::user()->id, 'editor_left_width');
192
+        if (empty($editor_left_width)) $editor_left_width='40';
193 193
 
194 194
         return view('contest.board.editor', [
195 195
             'page_title'=>"Problem Detail",
@@ -351,7 +351,7 @@  discard block
 block discarded – undo
351 351
         $contestModel=new ContestModel();
352 352
         $verified=$contestModel->isVerified($cid);
353 353
         $clearance=$contestModel->judgeClearance($cid, Auth::user()->id);
354
-        if ($clearance <= 2) {
354
+        if ($clearance<=2) {
355 355
             return Redirect::route('contest_detail', ['cid' => $cid]);
356 356
         }
357 357
         $contest_name=$contestModel->contestName($cid);
@@ -379,20 +379,20 @@  discard block
 block discarded – undo
379 379
     {
380 380
         $contestModel=new ContestModel();
381 381
         $clearance=$contestModel->judgeClearance($cid, Auth::user()->id);
382
-        if ($clearance <= 2) {
382
+        if ($clearance<=2) {
383 383
             return Redirect::route('contest_detail', ['cid' => $cid]);
384 384
         }
385 385
         $account=$contestModel->getContestAccount($cid);
386
-        if($account==null){
387
-            return ;
388
-        }else{
386
+        if ($account==null) {
387
+            return;
388
+        } else {
389 389
             $AccountExport=new AccountExport($account);
390 390
             $filename="ContestAccount$cid";
391 391
             return Excel::download($AccountExport, $filename.'.xlsx');
392 392
         }
393 393
     }
394 394
 
395
-    public function analysis($cid){
395
+    public function analysis($cid) {
396 396
         $contestModel=new ContestModel();
397 397
         $clearance=$contestModel->judgeClearance($cid, Auth::user()->id);
398 398
         if (!$clearance) {
@@ -413,17 +413,17 @@  discard block
 block discarded – undo
413 413
         ]);
414 414
     }
415 415
 
416
-    public function refreshContestRank($cid){
416
+    public function refreshContestRank($cid) {
417 417
         $contestModel=new ContestModel();
418 418
         $clearance=$contestModel->judgeClearance($cid, Auth::user()->id);
419
-        if ($clearance <= 2) {
419
+        if ($clearance<=2) {
420 420
             return Redirect::route('contest.detail', ['cid' => $cid]);
421 421
         }
422 422
         $contestRankRaw=$contestModel->contestRankCache($cid);
423 423
         Cache::tags(['contest', 'rank'])->put($cid, $contestRankRaw);
424 424
         Cache::tags(['contest', 'rank'])->put("contestAdmin$cid", $contestRankRaw);
425 425
         $end_time=strtotime(DB::table("contest")->where(["cid"=>$cid])->select("end_time")->first()["end_time"]);
426
-        if(time() > $end_time){
426
+        if (time()>$end_time) {
427 427
             $contestModel->storeContestRankInMySQL($cid, $contestRankRaw);
428 428
         }
429 429
         return Redirect::route('contest.rank', ['cid' => $cid]);
Please login to merge, or discard this patch.
app/Http/Controllers/AccountController.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -28,8 +28,8 @@  discard block
 block discarded – undo
28 28
         $accountModel=new AccountModel();
29 29
         $info=$accountModel->detail(Auth::user()->id);
30 30
         $feed=$accountModel->feed(Auth::user()->id);
31
-        $extraInfo = $accountModel->getExtra(Auth::user()->id, ['gender', 'contanct', 'school', 'country', 'location'],100);
32
-        $socialiteInfo = $accountModel->getSocialiteInfo(Auth::user()->id,100);
31
+        $extraInfo=$accountModel->getExtra(Auth::user()->id, ['gender', 'contanct', 'school', 'country', 'location'], 100);
32
+        $socialiteInfo=$accountModel->getSocialiteInfo(Auth::user()->id, 100);
33 33
         return view("account.dashboard", [
34 34
             'page_title'=>"DashBoard",
35 35
             'site_title'=>config("app.name"),
@@ -52,11 +52,11 @@  discard block
 block discarded – undo
52 52
     {
53 53
         $accountModel=new AccountModel();
54 54
         $info=$accountModel->detail(Auth::user()->id);
55
-        if(!empty(session('last_email_send'))){
56
-            $email_cooldown = 300 - (time() - session('last_email_send'));
55
+        if (!empty(session('last_email_send'))) {
56
+            $email_cooldown=300-(time()-session('last_email_send'));
57 57
         }
58
-        $extraInfo = $accountModel->getExtra(Auth::user()->id, ['gender', 'contanct', 'school', 'country', 'location'],100);
59
-        $socialiteInfo = $accountModel->getSocialiteInfo(Auth::user()->id,100);
58
+        $extraInfo=$accountModel->getExtra(Auth::user()->id, ['gender', 'contanct', 'school', 'country', 'location'], 100);
59
+        $socialiteInfo=$accountModel->getSocialiteInfo(Auth::user()->id, 100);
60 60
         return view("account.dashboard", [
61 61
             'page_title'=>"Settings",
62 62
             'site_title'=>config("app.name"),
Please login to merge, or discard this patch.
app/Http/Middleware/Privileged.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -18,16 +18,16 @@
 block discarded – undo
18 18
     public function handle($request, Closure $next)
19 19
     {
20 20
         if (Auth::check()) {
21
-            if(isset($request->gcode)){
21
+            if (isset($request->gcode)) {
22 22
                 //group privilege
23 23
                 $groupModel=new GroupModel();
24
-                if($groupModel->judgeClearance($groupModel->gid($request->gcode), Auth::user()->id)>=2){
24
+                if ($groupModel->judgeClearance($groupModel->gid($request->gcode), Auth::user()->id)>=2) {
25 25
                     return $next($request);
26 26
                 }
27
-            }elseif(isset($request->cid)) {
27
+            }elseif (isset($request->cid)) {
28 28
                 //contest privilege
29 29
                 $contestModel=new ContestModel();
30
-                if($contestModel->judgeClearance($request->cid, Auth::user()->id)==3){
30
+                if ($contestModel->judgeClearance($request->cid, Auth::user()->id)==3) {
31 31
                     return $next($request);
32 32
                 }
33 33
             }
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@
 block discarded – undo
24 24
                 if($groupModel->judgeClearance($groupModel->gid($request->gcode), Auth::user()->id)>=2){
25 25
                     return $next($request);
26 26
                 }
27
-            }elseif(isset($request->cid)) {
27
+            } elseif(isset($request->cid)) {
28 28
                 //contest privilege
29 29
                 $contestModel=new ContestModel();
30 30
                 if($contestModel->judgeClearance($request->cid, Auth::user()->id)==3){
Please login to merge, or discard this patch.
app/Console/Commands/Babel/Crawl.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -14,14 +14,14 @@  discard block
 block discarded – undo
14 14
      *
15 15
      * @var string
16 16
      */
17
-    protected $signature = 'babel:crawl {extension : The package name of the extension} {--action=crawl_problem : The action of the Crawler} {--con=all : The target problemset of the Crawler} {--cached : Whether cached or not}';
17
+    protected $signature='babel:crawl {extension : The package name of the extension} {--action=crawl_problem : The action of the Crawler} {--con=all : The target problemset of the Crawler} {--cached : Whether cached or not}';
18 18
 
19 19
     /**
20 20
      * The console command description.
21 21
      *
22 22
      * @var string
23 23
      */
24
-    protected $description = 'Crawl problems for a given Babel Extension to NOJ';
24
+    protected $description='Crawl problems for a given Babel Extension to NOJ';
25 25
 
26 26
     /**
27 27
      * Create a new command instance.
@@ -40,10 +40,10 @@  discard block
 block discarded – undo
40 40
      */
41 41
     public function handle()
42 42
     {
43
-        $extension = $this->argument('extension');
44
-        $action = $this->option('action');
45
-        $con = $this->option('con');
46
-        $cached = $this->option('cached');
43
+        $extension=$this->argument('extension');
44
+        $action=$this->option('action');
45
+        $con=$this->option('con');
46
+        $cached=$this->option('cached');
47 47
         $babel=new Babel();
48 48
         $babel->crawl([
49 49
             "name" => $extension,
Please login to merge, or discard this patch.
app/Models/AnnouncementModel.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@
 block discarded – undo
17 17
 
18 18
     public function fetch()
19 19
     {
20
-        $list=DB::table($this->table)->orderBy('post_date','desc')->get()->all();
20
+        $list=DB::table($this->table)->orderBy('post_date', 'desc')->get()->all();
21 21
         if (empty($list)) {
22 22
             return [];
23 23
         }
Please login to merge, or discard this patch.
app/Models/RankModel.php 2 patches
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
 use Illuminate\Support\Facades\DB;
8 8
 use Illuminate\Support\Arr;
9 9
 use App\Models\Rating\RatingCalculator;
10
-use Cache,Redis;
10
+use Cache, Redis;
11 11
 
12 12
 class RankModel extends Model
13 13
 {
@@ -65,28 +65,28 @@  discard block
 block discarded – undo
65 65
 
66 66
     public static function getColor($rankTitle)
67 67
     {
68
-        if(is_null($rankTitle)) return "";
68
+        if (is_null($rankTitle)) return "";
69 69
         return self::$casualRanking[$rankTitle];
70 70
     }
71 71
 
72 72
     public static function getProfessionalColor($rankTitle)
73 73
     {
74
-        if(is_null($rankTitle)) return self::$professionalRanking["None"];
74
+        if (is_null($rankTitle)) return self::$professionalRanking["None"];
75 75
         return self::$professionalRanking[$rankTitle];
76 76
     }
77 77
 
78 78
     public function list($num)
79 79
     {
80 80
         $rankList=Cache::tags(['rank'])->get('general');
81
-        if($rankList==null) $rankList=[];
82
-        $rankList=array_slice($rankList,0,$num);
83
-        $userInfoRaw=DB::table("users")->select("id as uid","avatar","name")->get()->all();
81
+        if ($rankList==null) $rankList=[];
82
+        $rankList=array_slice($rankList, 0, $num);
83
+        $userInfoRaw=DB::table("users")->select("id as uid", "avatar", "name")->get()->all();
84 84
         $userInfo=[];
85
-        foreach($userInfoRaw as $u){
85
+        foreach ($userInfoRaw as $u) {
86 86
             $userInfo[$u["uid"]]=$u;
87 87
         }
88
-        foreach($rankList as &$r){
89
-            $r["details"]=isset($userInfo[$r["uid"]])?$userInfo[$r["uid"]]:[];
88
+        foreach ($rankList as &$r) {
89
+            $r["details"]=isset($userInfo[$r["uid"]]) ? $userInfo[$r["uid"]] : [];
90 90
         }
91 91
         // var_dump($rankList); exit();
92 92
         return $rankList;
@@ -109,8 +109,8 @@  discard block
 block discarded – undo
109 109
                     $rankSolved=$rankItem["totValue"];
110 110
                 }
111 111
                 $rankTitle=$this->getRankTitle($rankValue);
112
-                Cache::tags(['rank',$rankItem["uid"]])->put("rank", $rankValue, 86400);
113
-                Cache::tags(['rank',$rankItem["uid"]])->put("title", $rankTitle, 86400);
112
+                Cache::tags(['rank', $rankItem["uid"]])->put("rank", $rankValue, 86400);
113
+                Cache::tags(['rank', $rankItem["uid"]])->put("title", $rankTitle, 86400);
114 114
                 $rankListCached[]=[
115 115
                     "uid"=>$rankItem["uid"],
116 116
                     "rank"=>$rankValue,
@@ -127,14 +127,14 @@  discard block
 block discarded – undo
127 127
 
128 128
     public function getProfessionalRanking()
129 129
     {
130
-        $professionalRankList = [];
131
-        $verifiedUsers = DB::table("users")->select("professional_rate","id as uid","avatar","name")->get()->all();
132
-        $rankIter = 0;
133
-        foreach($verifiedUsers as $user) {
134
-            $rankVal = $user['professional_rate'];
135
-            $rankTitle = self::getProfessionalTitle($rankVal);
136
-            $titleColor = self::getProfessionalColor($rankTitle);
137
-            $professionalRankList[$rankIter++] = [
130
+        $professionalRankList=[];
131
+        $verifiedUsers=DB::table("users")->select("professional_rate", "id as uid", "avatar", "name")->get()->all();
132
+        $rankIter=0;
133
+        foreach ($verifiedUsers as $user) {
134
+            $rankVal=$user['professional_rate'];
135
+            $rankTitle=self::getProfessionalTitle($rankVal);
136
+            $titleColor=self::getProfessionalColor($rankTitle);
137
+            $professionalRankList[$rankIter++]=[
138 138
                 "name"=>$user["name"],
139 139
                 "uid"=>$user["uid"],
140 140
                 "avatar"=>$user["avatar"],
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
                 $tot+=$c;
157 157
             }
158 158
             foreach ($this->casualRankingPer as &$c) {
159
-                $c=round($c*$totUsers/$tot);
159
+                $c=round($c * $totUsers / $tot);
160 160
                 $cur+=$c;
161 161
                 $c=$cur;
162 162
             }
@@ -167,16 +167,16 @@  discard block
 block discarded – undo
167 167
 
168 168
     public function getRankTitle($rankVal)
169 169
     {
170
-        foreach($this->casualRankingPer as $title=>$c){
171
-            if($rankVal<=$c) return $title;
170
+        foreach ($this->casualRankingPer as $title=>$c) {
171
+            if ($rankVal<=$c) return $title;
172 172
         }
173 173
         return Arr::last($this->casualRankingPer);
174 174
     }
175 175
 
176 176
     public static function getProfessionalTitle($rankVal)
177 177
     {
178
-        foreach(self::$professionalRankingPer as $title=>$point) {
179
-            if($rankVal >= $point) return $title;
178
+        foreach (self::$professionalRankingPer as $title=>$point) {
179
+            if ($rankVal>=$point) return $title;
180 180
         }
181 181
         return Arr::last(self::$professionalRankingPer);
182 182
     }
Please login to merge, or discard this patch.
Braces   +15 added lines, -5 removed lines patch added patch discarded remove patch
@@ -65,20 +65,26 @@  discard block
 block discarded – undo
65 65
 
66 66
     public static function getColor($rankTitle)
67 67
     {
68
-        if(is_null($rankTitle)) return "";
68
+        if(is_null($rankTitle)) {
69
+            return "";
70
+        }
69 71
         return self::$casualRanking[$rankTitle];
70 72
     }
71 73
 
72 74
     public static function getProfessionalColor($rankTitle)
73 75
     {
74
-        if(is_null($rankTitle)) return self::$professionalRanking["None"];
76
+        if(is_null($rankTitle)) {
77
+            return self::$professionalRanking["None"];
78
+        }
75 79
         return self::$professionalRanking[$rankTitle];
76 80
     }
77 81
 
78 82
     public function list($num)
79 83
     {
80 84
         $rankList=Cache::tags(['rank'])->get('general');
81
-        if($rankList==null) $rankList=[];
85
+        if($rankList==null) {
86
+            $rankList=[];
87
+        }
82 88
         $rankList=array_slice($rankList,0,$num);
83 89
         $userInfoRaw=DB::table("users")->select("id as uid","avatar","name")->get()->all();
84 90
         $userInfo=[];
@@ -168,7 +174,9 @@  discard block
 block discarded – undo
168 174
     public function getRankTitle($rankVal)
169 175
     {
170 176
         foreach($this->casualRankingPer as $title=>$c){
171
-            if($rankVal<=$c) return $title;
177
+            if($rankVal<=$c) {
178
+                return $title;
179
+            }
172 180
         }
173 181
         return Arr::last($this->casualRankingPer);
174 182
     }
@@ -176,7 +184,9 @@  discard block
 block discarded – undo
176 184
     public static function getProfessionalTitle($rankVal)
177 185
     {
178 186
         foreach(self::$professionalRankingPer as $title=>$point) {
179
-            if($rankVal >= $point) return $title;
187
+            if($rankVal >= $point) {
188
+                return $title;
189
+            }
180 190
         }
181 191
         return Arr::last(self::$professionalRankingPer);
182 192
     }
Please login to merge, or discard this patch.
app/Console/Commands/Babel/SyncContest.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -14,14 +14,14 @@  discard block
 block discarded – undo
14 14
      *
15 15
      * @var string
16 16
      */
17
-    protected $signature = 'babel:sync {extension : The package name of the extension} {--vcid= : The target contest of the Crawler} {--gid=1 : The holding group}';
17
+    protected $signature='babel:sync {extension : The package name of the extension} {--vcid= : The target contest of the Crawler} {--gid=1 : The holding group}';
18 18
 
19 19
     /**
20 20
      * The console command description.
21 21
      *
22 22
      * @var string
23 23
      */
24
-    protected $description = 'Crawl contests for a given Babel Extension to NOJ';
24
+    protected $description='Crawl contests for a given Babel Extension to NOJ';
25 25
 
26 26
     /**
27 27
      * Create a new command instance.
@@ -40,16 +40,16 @@  discard block
 block discarded – undo
40 40
      */
41 41
     public function handle()
42 42
     {
43
-        $extension = $this->argument('extension');
44
-        $vcid = $this->option('vcid');
45
-        $gid = $this->option('gid');
46
-        $className = "App\\Babel\\Extension\\$extension\\Synchronizer";
47
-        $all_data = [
43
+        $extension=$this->argument('extension');
44
+        $vcid=$this->option('vcid');
45
+        $gid=$this->option('gid');
46
+        $className="App\\Babel\\Extension\\$extension\\Synchronizer";
47
+        $all_data=[
48 48
             'oj'=>$extension,
49 49
             'vcid'=>$vcid,
50 50
             'gid'=>$gid,
51 51
         ];
52
-        $Sync = new $className($all_data);
52
+        $Sync=new $className($all_data);
53 53
         $Sync->crawlContest();
54 54
     }
55 55
 }
Please login to merge, or discard this patch.
app/Http/Controllers/Ajax/ContestController.php 2 patches
Spacing   +51 added lines, -51 removed lines patch added patch discarded remove patch
@@ -21,22 +21,22 @@  discard block
 block discarded – undo
21 21
             'cid' => 'required|integer',
22 22
             'uid' => 'required|integer'
23 23
         ]);
24
-        $cid = $request->input('cid');
25
-        $uid = $request->input('uid');
24
+        $cid=$request->input('cid');
25
+        $uid=$request->input('uid');
26 26
 
27
-        $groupModel = new GroupModel();
28
-        $contestModel = new ContestModel();
27
+        $groupModel=new GroupModel();
28
+        $contestModel=new ContestModel();
29 29
 
30
-        $contest_info = $contestModel->basic($cid);
31
-        if($contestModel->judgeClearance($cid,Auth::user()->id) != 3){
30
+        $contest_info=$contestModel->basic($cid);
31
+        if ($contestModel->judgeClearance($cid, Auth::user()->id)!=3) {
32 32
             return ResponseModel::err(2001);
33 33
         }
34 34
 
35
-        if($groupModel->judgeClearance($contest_info['gid'],$uid) < 2){
35
+        if ($groupModel->judgeClearance($contest_info['gid'], $uid)<2) {
36 36
             return ResponseModel::err(7004);
37 37
         }
38 38
 
39
-        $contestModel->assignMember($cid,$uid);
39
+        $contestModel->assignMember($cid, $uid);
40 40
         return ResponseModel::success(200);
41 41
     }
42 42
 
@@ -45,30 +45,30 @@  discard block
 block discarded – undo
45 45
         $request->validate([
46 46
             'cid' => 'required|integer',
47 47
         ]);
48
-        $cid = $request->input('cid');
48
+        $cid=$request->input('cid');
49 49
 
50
-        $contestModel = new ContestModel();
51
-        $groupModel = new GroupModel();
50
+        $contestModel=new ContestModel();
51
+        $groupModel=new GroupModel();
52 52
 
53
-        $contest_problems = $contestModel->problems($cid);
54
-        $contest_detail = $contestModel->basic($cid);
55
-        $contest_detail['problems'] = $contest_problems;
56
-        $assign_uid = $contest_detail['assign_uid'];
57
-        $clearance = $contestModel->judgeClearance($cid,Auth::user()->id);
58
-        if($clearance != 3){
53
+        $contest_problems=$contestModel->problems($cid);
54
+        $contest_detail=$contestModel->basic($cid);
55
+        $contest_detail['problems']=$contest_problems;
56
+        $assign_uid=$contest_detail['assign_uid'];
57
+        $clearance=$contestModel->judgeClearance($cid, Auth::user()->id);
58
+        if ($clearance!=3) {
59 59
             return ResponseModel::err(2001);
60 60
         }
61
-        if($assign_uid != 0){
62
-            $assignee = $groupModel->userProfile($assign_uid,$contest_detail['gid']);
63
-        }else{
64
-            $assignee = null;
61
+        if ($assign_uid!=0) {
62
+            $assignee=$groupModel->userProfile($assign_uid, $contest_detail['gid']);
63
+        } else {
64
+            $assignee=null;
65 65
         }
66
-        $ret = [
66
+        $ret=[
67 67
             'contest_info' => $contest_detail,
68 68
             'assignee' => $assignee,
69
-            'is_admin' => $clearance == 3,
69
+            'is_admin' => $clearance==3,
70 70
         ];
71
-        return ResponseModel::success(200,null,$ret);
71
+        return ResponseModel::success(200, null, $ret);
72 72
     }
73 73
 
74 74
     public function fetchClarification(Request $request)
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
         $all_data=$request->all();
102 102
 
103 103
         $contestModel=new ContestModel();
104
-        return $contestModel->updateProfessionalRate($all_data["cid"])?ResponseModel::success(200):ResponseModel::err(1001);
104
+        return $contestModel->updateProfessionalRate($all_data["cid"]) ?ResponseModel::success(200) : ResponseModel::err(1001);
105 105
     }
106 106
 
107 107
     public function requestClarification(Request $request)
@@ -158,16 +158,16 @@  discard block
 block discarded – undo
158 158
         $groupModel=new GroupModel();
159 159
         $basic=$contestModel->basic($all_data["cid"]);
160 160
 
161
-        if(!$basic["registration"]){
161
+        if (!$basic["registration"]) {
162 162
             return ResponseModel::err(4003);
163 163
         }
164
-        if(strtotime($basic["registration_due"])<time()){
164
+        if (strtotime($basic["registration_due"])<time()) {
165 165
             return ResponseModel::err(4004);
166 166
         }
167
-        if(!$basic["registant_type"]){
167
+        if (!$basic["registant_type"]) {
168 168
             return ResponseModel::err(4005);
169 169
         }
170
-        if($basic["registant_type"]==1 && !$groupModel->isMember($basic["gid"], Auth::user()->id)){
170
+        if ($basic["registant_type"]==1 && !$groupModel->isMember($basic["gid"], Auth::user()->id)) {
171 171
             return ResponseModel::err(4005);
172 172
         }
173 173
 
@@ -186,15 +186,15 @@  discard block
 block discarded – undo
186 186
             'end_time' => 'required|date|after:begin_time',
187 187
             'description' => 'string'
188 188
         ]);
189
-        $all_data = $request->all();
190
-        $cid = $all_data['cid'];
189
+        $all_data=$request->all();
190
+        $cid=$all_data['cid'];
191 191
 
192
-        $contestModel = new ContestModel();
193
-        if($contestModel->judgeClearance($all_data['cid'],Auth::user()->id) != 3){
192
+        $contestModel=new ContestModel();
193
+        if ($contestModel->judgeClearance($all_data['cid'], Auth::user()->id)!=3) {
194 194
             return ResponseModel::err(2001);
195 195
         }
196 196
 
197
-        if($contestModel->remainingTime($cid) > 0){
197
+        if ($contestModel->remainingTime($cid)>0) {
198 198
             $problems=explode(",", $all_data["problems"]);
199 199
             if (count($problems)>26) {
200 200
                 return ResponseModel::err(4002);
@@ -211,32 +211,32 @@  discard block
 block discarded – undo
211 211
                     ];
212 212
                 }
213 213
             }
214
-            $allow_update = ['name','description','begin_time','end_time'];
214
+            $allow_update=['name', 'description', 'begin_time', 'end_time'];
215 215
 
216
-            foreach($all_data as $key => $value){
217
-                if(!in_array($key,$allow_update)){
216
+            foreach ($all_data as $key => $value) {
217
+                if (!in_array($key, $allow_update)) {
218 218
                     unset($all_data[$key]);
219 219
                 }
220 220
             }
221
-            $contestModel->contestUpdate($cid,$all_data,$problemSet);
221
+            $contestModel->contestUpdate($cid, $all_data, $problemSet);
222 222
             return ResponseModel::success(200);
223
-        }else{
224
-            $allow_update = ['name','description'];
223
+        } else {
224
+            $allow_update=['name', 'description'];
225 225
 
226
-            foreach($all_data as $key => $value){
227
-                if(!in_array($key,$allow_update)){
226
+            foreach ($all_data as $key => $value) {
227
+                if (!in_array($key, $allow_update)) {
228 228
                     unset($all_data[$key]);
229 229
                 }
230 230
             }
231
-            $contestModel->contestUpdate($cid,$all_data,false);
232
-            return ResponseModel::success(200,'
231
+            $contestModel->contestUpdate($cid, $all_data, false);
232
+            return ResponseModel::success(200, '
233 233
                 Successful! However, only the name and description of the match can be changed for the match that has been finished.
234 234
             ');
235 235
         }
236 236
 
237 237
     }
238 238
 
239
-    public function issueAnnouncement(Request $request){
239
+    public function issueAnnouncement(Request $request) {
240 240
         $request->validate([
241 241
             'cid' => 'required|integer',
242 242
             'title' => 'required|string|max:250',
@@ -256,7 +256,7 @@  discard block
 block discarded – undo
256 256
         }
257 257
     }
258 258
 
259
-    public function replyClarification(Request $request){
259
+    public function replyClarification(Request $request) {
260 260
         $request->validate([
261 261
             'cid' => 'required|integer',
262 262
             'ccid' => 'required|integer',
@@ -276,7 +276,7 @@  discard block
 block discarded – undo
276 276
         }
277 277
     }
278 278
 
279
-    public function setClarificationPublic(Request $request){
279
+    public function setClarificationPublic(Request $request) {
280 280
         $request->validate([
281 281
             'cid' => 'required|integer',
282 282
             'ccid' => 'required|integer',
@@ -309,7 +309,7 @@  discard block
 block discarded – undo
309 309
         $groupModel=new GroupModel();
310 310
         $contestModel=new ContestModel();
311 311
         $verified=$contestModel->isVerified($all_data["cid"]);
312
-        if(!$verified){
312
+        if (!$verified) {
313 313
             return ResponseModel::err(2001);
314 314
         }
315 315
         $gid=$contestModel->gid($all_data["cid"]);
@@ -331,13 +331,13 @@  discard block
 block discarded – undo
331 331
         $request->validate([
332 332
             'cid' => 'required|integer'
333 333
         ]);
334
-        $cid = $request->input('cid');
334
+        $cid=$request->input('cid');
335 335
 
336 336
         $contestModel=new ContestModel();
337 337
         $clearance=$contestModel->judgeClearance($cid, Auth::user()->id);
338
-        if ($clearance < 1) {
338
+        if ($clearance<1) {
339 339
             return ResponseModel::err(7002);
340 340
         }
341
-        return ResponseModel::success(200,null,$contestModel->praticeAnalysis($cid));
341
+        return ResponseModel::success(200, null, $contestModel->praticeAnalysis($cid));
342 342
     }
343 343
 }
Please login to merge, or discard this patch.
Braces   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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){
Please login to merge, or discard this patch.
app/Console/Commands/Babel/RefreshRank.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -14,14 +14,14 @@  discard block
 block discarded – undo
14 14
      *
15 15
      * @var string
16 16
      */
17
-    protected $signature = 'babel:rerank {extension : The package name of the extension} {--vcid= : The target contest of the Crawler} {--gid=1 : The holding group} {--cid= : The NOJ contest}';
17
+    protected $signature='babel:rerank {extension : The package name of the extension} {--vcid= : The target contest of the Crawler} {--gid=1 : The holding group} {--cid= : The NOJ contest}';
18 18
 
19 19
     /**
20 20
      * The console command description.
21 21
      *
22 22
      * @var string
23 23
      */
24
-    protected $description = 'Refresh Rank from a remote contest';
24
+    protected $description='Refresh Rank from a remote contest';
25 25
 
26 26
     /**
27 27
      * Create a new command instance.
@@ -40,18 +40,18 @@  discard block
 block discarded – undo
40 40
      */
41 41
     public function handle()
42 42
     {
43
-        $extension = $this->argument('extension');
44
-        $vcid = $this->option('vcid');
45
-        $gid = $this->option('gid');
46
-        $cid = $this->option('cid');
47
-        $className = "App\\Babel\\Extension\\$extension\\Synchronizer";
48
-        $all_data = [
43
+        $extension=$this->argument('extension');
44
+        $vcid=$this->option('vcid');
45
+        $gid=$this->option('gid');
46
+        $cid=$this->option('cid');
47
+        $className="App\\Babel\\Extension\\$extension\\Synchronizer";
48
+        $all_data=[
49 49
             'oj'=>$extension,
50 50
             'vcid'=>$vcid,
51 51
             'gid'=>$gid,
52 52
             'cid'=>$cid,
53 53
         ];
54
-        $Sync = new $className($all_data);
54
+        $Sync=new $className($all_data);
55 55
         $Sync->crawlRank();
56 56
     }
57 57
 }
Please login to merge, or discard this patch.