Passed
Pull Request — master (#88)
by Chenyi
04:29
created
app/Jobs/ProcessSubmission.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
 {
15 15
     use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
16 16
 
17
-    public $tries = 5;
17
+    public $tries=5;
18 18
     protected $all_data=[];
19 19
 
20 20
     /**
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
 
41 41
     public function failed()
42 42
     {
43
-        $submissionModel = new SubmissionModel();
43
+        $submissionModel=new SubmissionModel();
44 44
         $submissionModel->updateSubmission($this->all_data["sid"], ["verdict"=>"Submission Error"]);
45 45
     }
46 46
 }
Please login to merge, or discard this patch.
app/Http/Controllers/ContestController.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@
 block discarded – undo
21 21
     public function index()
22 22
     {
23 23
         $contestModel=new ContestModel();
24
-        $return_list=$contestModel->list(Auth::check()?Auth::user()->id:0);
24
+        $return_list=$contestModel->list(Auth::check() ?Auth::user()->id : 0);
25 25
         $featured=$contestModel->featured();
26 26
         return view('contest.index', [
27 27
             'page_title'=>"Contest",
Please login to merge, or discard this patch.
app/Http/Controllers/Ajax/SubmissionController.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -57,14 +57,14 @@
 block discarded – undo
57 57
             return ResponseModel::err(3002);
58 58
         }
59 59
         $submissionModel=new SubmissionModel();
60
-        if($all_data["method"]==1){
60
+        if ($all_data["method"]==1) {
61 61
             // NOJ Share
62 62
             $status=$submissionModel->share($all_data["sid"], Auth::check() ? Auth::user()->id : null);
63
-            return empty($status)?ResponseModel::err(1001):ResponseModel::success(200, null, $status);
64
-        } elseif($all_data["method"]==2){
63
+            return empty($status) ?ResponseModel::err(1001) : ResponseModel::success(200, null, $status);
64
+        } elseif ($all_data["method"]==2) {
65 65
             // Pastebin
66 66
             $status=$submissionModel->sharePB($all_data["sid"], Auth::check() ? Auth::user()->id : null);
67
-            return empty($status)?ResponseModel::err(1001):ResponseModel::success(200, null, $status);
67
+            return empty($status) ?ResponseModel::err(1001) : ResponseModel::success(200, null, $status);
68 68
         } else {
69 69
             return ResponseModel::err(6002);
70 70
         }
Please login to merge, or discard this patch.
app/Http/Controllers/Ajax/ProblemController.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -111,8 +111,8 @@  discard block
 block discarded – undo
111 111
         if (empty($basic)) {
112 112
             return ResponseModel::err(3001);
113 113
         }
114
-        $ret=$problemModel->addSolution($pid,Auth::user()->id,$content);
115
-        return $ret?ResponseModel::success(200):ResponseModel::err(3003);
114
+        $ret=$problemModel->addSolution($pid, Auth::user()->id, $content);
115
+        return $ret ?ResponseModel::success(200) : ResponseModel::err(3003);
116 116
     }
117 117
     /**
118 118
      * The Ajax Problem Solution Discussion Update.
@@ -127,8 +127,8 @@  discard block
 block discarded – undo
127 127
         $problemModel=new ProblemModel();
128 128
         $psoid=$all_data["psoid"];
129 129
         $content=$all_data["content"];
130
-        $ret=$problemModel->updateSolution($psoid,Auth::user()->id,$content);
131
-        return $ret?ResponseModel::success(200):ResponseModel::err(3004);
130
+        $ret=$problemModel->updateSolution($psoid, Auth::user()->id, $content);
131
+        return $ret ?ResponseModel::success(200) : ResponseModel::err(3004);
132 132
     }
133 133
     /**
134 134
      * The Ajax Problem Solution Discussion Delete.
@@ -142,8 +142,8 @@  discard block
 block discarded – undo
142 142
         $all_data=$request->all();
143 143
         $problemModel=new ProblemModel();
144 144
         $psoid=$all_data["psoid"];
145
-        $ret=$problemModel->removeSolution($psoid,Auth::user()->id);
146
-        return $ret?ResponseModel::success(200):ResponseModel::err(3004);
145
+        $ret=$problemModel->removeSolution($psoid, Auth::user()->id);
146
+        return $ret ?ResponseModel::success(200) : ResponseModel::err(3004);
147 147
     }
148 148
     /**
149 149
      * The Ajax Problem Solution Discussion Vote.
@@ -158,8 +158,8 @@  discard block
 block discarded – undo
158 158
         $problemModel=new ProblemModel();
159 159
         $psoid=$all_data["psoid"];
160 160
         $type=$all_data["type"];
161
-        $ret=$problemModel->voteSolution($psoid,Auth::user()->id,$type);
162
-        return $ret["ret"]?ResponseModel::success(200,null,["votes"=>$ret["votes"],"select"=>$ret["select"]]):ResponseModel::err(3004);
161
+        $ret=$problemModel->voteSolution($psoid, Auth::user()->id, $type);
162
+        return $ret["ret"] ?ResponseModel::success(200, null, ["votes"=>$ret["votes"], "select"=>$ret["select"]]) : ResponseModel::err(3004);
163 163
     }
164 164
     /**
165 165
      * The Ajax Problem Solution Submit.
Please login to merge, or discard this patch.
app/Models/ContestModel.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -150,22 +150,22 @@  discard block
 block discarded – undo
150 150
                 ->join('contest', 'group_member.gid', '=', 'contest.gid')
151 151
                 ->leftJoin('contest_participant', 'contest.cid', '=', 'contest_participant.cid')
152 152
                 ->where(
153
-                    function ($query) {
153
+                    function($query) {
154 154
                         $query->where('public', 1)
155 155
                               ->where('audit', 1);
156 156
                     }
157 157
                 )
158 158
                 ->orWhere(
159
-                    function ($query) use ($uid) {
159
+                    function($query) use ($uid) {
160 160
                         $query->where('group_member.uid', $uid)
161 161
                                 ->where('group_member.role', '>', 0)
162
-                                ->where(function ($query) use ($uid) {
162
+                                ->where(function($query) use ($uid) {
163 163
                                     $query->where('contest_participant.uid', $uid)
164 164
                                           ->orWhereNull('contest_participant.uid');
165 165
                                 })
166
-                              ->where(function ($query) {
166
+                              ->where(function($query) {
167 167
                                   $query->where('registration', 0)
168
-                                                ->orWhere(function ($query) {
168
+                                                ->orWhere(function($query) {
169 169
                                                     $query->where('registration', 1)
170 170
                                                           ->whereNotNull('contest_participant.uid');
171 171
                                                 });
@@ -505,7 +505,7 @@  discard block
 block discarded – undo
505 505
                     "problem_detail" => $prob_detail
506 506
                 ];
507 507
             }
508
-            usort($ret, function ($a, $b) {
508
+            usort($ret, function($a, $b) {
509 509
                 if ($a["score"]==$b["score"]) {
510 510
                     if ($a["penalty"]==$b["penalty"]) {
511 511
                         return 0;
@@ -552,7 +552,7 @@  discard block
 block discarded – undo
552 552
                     "problem_detail" => $prob_detail
553 553
                 ];
554 554
             }
555
-            usort($ret, function ($a, $b) {
555
+            usort($ret, function($a, $b) {
556 556
                 if ($a["score"]==$b["score"]) {
557 557
                     if ($a["solved"]==$b["solved"]) {
558 558
                         return 0;
@@ -645,7 +645,7 @@  discard block
 block discarded – undo
645 645
     {
646 646
         return DB::table("contest_clarification")->where([
647 647
             "cid"=>$cid
648
-        ])->where(function ($query) {
648
+        ])->where(function($query) {
649 649
             $query->where([
650 650
                 "public"=>1
651 651
             ])->orWhere([
@@ -793,7 +793,7 @@  discard block
 block discarded – undo
793 793
                 "users.id",
794 794
                 "=",
795 795
                 "submission.uid"
796
-            )->where(function ($query) use ($frozen_time) {
796
+            )->where(function($query) use ($frozen_time) {
797 797
                 $query->where(
798 798
                     "submission_date",
799 799
                     "<",
@@ -985,7 +985,7 @@  discard block
 block discarded – undo
985 985
 
986 986
     public function arrangeContest($gid, $config, $problems)
987 987
     {
988
-        DB::transaction(function () use ($gid, $config, $problems) {
988
+        DB::transaction(function() use ($gid, $config, $problems) {
989 989
             $cid=DB::table($this->tableName)->insertGetId([
990 990
                 "gid"=>$gid,
991 991
                 "name"=>$config["name"],
Please login to merge, or discard this patch.
app/Models/JudgerModel.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -61,7 +61,7 @@
 block discarded – undo
61 61
     {
62 62
         $curl=curl_init();
63 63
 
64
-        if($curl===false) return [];
64
+        if ($curl===false) return [];
65 65
 
66 66
         curl_setopt_array($curl, array(
67 67
             CURLOPT_PORT => $port,
Please login to merge, or discard this patch.
app/Http/Controllers/VirtualJudge/Judge.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -398,7 +398,7 @@
 block discarded – undo
398 398
      */
399 399
     private function get_last_uva($earliest)
400 400
     {
401
-        $ret = [];
401
+        $ret=[];
402 402
         if (!$earliest) {
403 403
             return $ret;
404 404
         }
Please login to merge, or discard this patch.
app/Models/AccountModel.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -25,8 +25,8 @@  discard block
 block discarded – undo
25 25
     public function feed($uid=null)
26 26
     {
27 27
         $ret=[];
28
-        $solution=DB::table("problem_solution")->join("problem","problem.pid","=","problem_solution.pid")->where(["uid"=>$uid,"audit"=>1])->select("problem.pid as pid","pcode","title","problem_solution.created_at as created_at")->get()->all();
29
-        foreach($solution as &$s){
28
+        $solution=DB::table("problem_solution")->join("problem", "problem.pid", "=", "problem_solution.pid")->where(["uid"=>$uid, "audit"=>1])->select("problem.pid as pid", "pcode", "title", "problem_solution.created_at as created_at")->get()->all();
29
+        foreach ($solution as &$s) {
30 30
             $s["type"]="event";
31 31
             $s["color"]="wemd-orange";
32 32
             $s["icon"]="comment-check-outline";
@@ -91,8 +91,8 @@  discard block
 block discarded – undo
91 91
             "verdict"=>"Accepted"
92 92
         ])->join("problem", "problem.pid", "=", "submission.pid")->select('pcode')->distinct()->get()->all();
93 93
         $ret["solvedCount"]=count($ret["solved"]);
94
-        $ret["rank"]=Cache::tags(['rank',$ret["id"]])->get("rank", "N/A");
95
-        $ret["rankTitle"]=Cache::tags(['rank',$ret["id"]])->get("title");
94
+        $ret["rank"]=Cache::tags(['rank', $ret["id"]])->get("rank", "N/A");
95
+        $ret["rankTitle"]=Cache::tags(['rank', $ret["id"]])->get("title");
96 96
         $ret["rankTitleColor"]=RankModel::getColor($ret["rankTitle"]);
97 97
         if (Cache::tags(['bing', 'pic'])->get(date("Y-m-d"))==null) {
98 98
             $bing=new BingPhoto([
Please login to merge, or discard this patch.
app/Http/Controllers/Auth/ForgotPasswordController.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@
 block discarded – undo
37 37
      */
38 38
     public function showLinkRequestForm()
39 39
     {
40
-        return view('auth.passwords.email',[
40
+        return view('auth.passwords.email', [
41 41
             'page_title'=>"Reset Password",
42 42
             'site_title'=>"NOJ",
43 43
             'navigation' => "Account"
Please login to merge, or discard this patch.