@@ -57,7 +57,9 @@ discard block |
||
57 | 57 | $cid=$this->cid; |
58 | 58 | $contest=EloquentContestModel::find($cid); |
59 | 59 | |
60 | - if (!$contest->isJudgingComplete()) throw new Exception('Judging Incompleted'); |
|
60 | + if (!$contest->isJudgingComplete()) { |
|
61 | + throw new Exception('Judging Incompleted'); |
|
62 | + } |
|
61 | 63 | |
62 | 64 | $acceptedSubmissions=$contest->submissions->whereIn('verdict', [ |
63 | 65 | 'Accepted', |
@@ -79,8 +81,11 @@ discard block |
||
79 | 81 | $lang=$this->supportLang[$lang]; |
80 | 82 | $ext=$lang; |
81 | 83 | Storage::put("contest/anticheat/$cid/raw/$prob/$lang/[$submission->uid][$submission->sid].$ext", $submission->solution); |
82 | - if (!isset($probLangs[$prob][$lang])) $probLangs[$prob][$lang]=1; |
|
83 | - else $probLangs[$prob][$lang]++; |
|
84 | + if (!isset($probLangs[$prob][$lang])) { |
|
85 | + $probLangs[$prob][$lang]=1; |
|
86 | + } else { |
|
87 | + $probLangs[$prob][$lang]++; |
|
88 | + } |
|
84 | 89 | $totProb++; |
85 | 90 | } |
86 | 91 | } |
@@ -148,13 +153,19 @@ discard block |
||
148 | 153 | private function afterWork($cid, $prob, $lang, $rawContent) |
149 | 154 | { |
150 | 155 | foreach (preg_split('~[\r\n]+~', $rawContent) as $line) { |
151 | - if (blank($line) or ctype_space($line)) continue; |
|
156 | + if (blank($line) or ctype_space($line)) { |
|
157 | + continue; |
|
158 | + } |
|
152 | 159 | // [3057][64659].c++ consists for 100 % of [3057][64679].c++ material |
153 | 160 | $line=explode('%', $line); |
154 | - if (!isset($line[1])) continue; |
|
161 | + if (!isset($line[1])) { |
|
162 | + continue; |
|
163 | + } |
|
155 | 164 | [$uid1, $sid1, $percentage]=sscanf($line[0], "[%d][%d].$lang consists for %d "); |
156 | 165 | [$uid2, $sid2]=sscanf($line[1], " of [%d][%d].$lang material"); |
157 | - if ($uid1==$uid2) continue; |
|
166 | + if ($uid1==$uid2) { |
|
167 | + continue; |
|
168 | + } |
|
158 | 169 | $username1=User::find($uid1)->name; |
159 | 170 | $username2=User::find($uid2)->name; |
160 | 171 | $this->retArr[]=[ |
@@ -29,8 +29,8 @@ discard block |
||
29 | 29 | } |
30 | 30 | |
31 | 31 | /** |
32 | - * @return array |
|
33 | - */ |
|
32 | + * @return array |
|
33 | + */ |
|
34 | 34 | public function registerEvents(): array |
35 | 35 | { |
36 | 36 | return [ |
@@ -47,8 +47,8 @@ discard block |
||
47 | 47 | } |
48 | 48 | |
49 | 49 | /** |
50 | - * @return \Illuminate\Support\Collection |
|
51 | - */ |
|
50 | + * @return \Illuminate\Support\Collection |
|
51 | + */ |
|
52 | 52 | public function collection() |
53 | 53 | { |
54 | 54 | $maxium=$this->config['maxium'] ?? false; |
@@ -96,7 +96,9 @@ |
||
96 | 96 | $groupModel=new GroupModel(); |
97 | 97 | $basic_info=$groupModel->details($gcode); |
98 | 98 | $clearance=$groupModel->judgeClearance($basic_info["gid"], Auth::user()->id); |
99 | - if ($clearance<1) return Redirect::route('group.detail', ['gcode' => $gcode]); |
|
99 | + if ($clearance<1) { |
|
100 | + return Redirect::route('group.detail', ['gcode' => $gcode]); |
|
101 | + } |
|
100 | 102 | $group_info=$groupModel->details($gcode); |
101 | 103 | return view('group.settings.analysis', [ |
102 | 104 | 'page_title'=>"Group Analysis", |
@@ -184,9 +184,13 @@ |
||
184 | 184 | $all_data=$request->all(); |
185 | 185 | |
186 | 186 | $groupModel=new OutdatedGroupModel(); |
187 | - if ($all_data["gcode"]=="create") return ResponseModel::err(7005); |
|
187 | + if ($all_data["gcode"]=="create") { |
|
188 | + return ResponseModel::err(7005); |
|
189 | + } |
|
188 | 190 | $is_group=$groupModel->isGroup($all_data["gcode"]); |
189 | - if ($is_group) return ResponseModel::err(7006); |
|
191 | + if ($is_group) { |
|
192 | + return ResponseModel::err(7006); |
|
193 | + } |
|
190 | 194 | |
191 | 195 | $allow_extension=['jpg', 'png', 'jpeg', 'gif', 'bmp']; |
192 | 196 | if (!empty($request->file('img')) && $request->file('img')->isValid()) { |
@@ -247,11 +247,17 @@ |
||
247 | 247 | |
248 | 248 | $groupModel=new GroupModel(); |
249 | 249 | $is_user=$groupModel->isUser($all_data["email"]); |
250 | - if (!$is_user) return ResponseModel::err(2006); |
|
250 | + if (!$is_user) { |
|
251 | + return ResponseModel::err(2006); |
|
252 | + } |
|
251 | 253 | $clearance=$groupModel->judgeClearance($all_data["gid"], Auth::user()->id); |
252 | - if ($clearance<2) return ResponseModel::err(7002); |
|
254 | + if ($clearance<2) { |
|
255 | + return ResponseModel::err(7002); |
|
256 | + } |
|
253 | 257 | $targetClearance=$groupModel->judgeEmailClearance($all_data["gid"], $all_data["email"]); |
254 | - if ($targetClearance!=-3) return ResponseModel::err(7003); |
|
258 | + if ($targetClearance!=-3) { |
|
259 | + return ResponseModel::err(7003); |
|
260 | + } |
|
255 | 261 | $groupModel->inviteMember($all_data["gid"], $all_data["email"]); |
256 | 262 | $basic=$groupModel->basic($all_data['gid']); |
257 | 263 | $url=route('group.detail', ['gcode' => $basic['gcode']]); |
@@ -326,7 +326,9 @@ discard block |
||
326 | 326 | if ($contestModel->judgeClearance($cid, Auth::user()->id)!=3) { |
327 | 327 | return ResponseModel::err(2001); |
328 | 328 | } |
329 | - if (!is_null(Cache::tags(['contest', 'admin', 'PDFGenerate'])->get($cid))) return ResponseModel::err(8001); |
|
329 | + if (!is_null(Cache::tags(['contest', 'admin', 'PDFGenerate'])->get($cid))) { |
|
330 | + return ResponseModel::err(8001); |
|
331 | + } |
|
330 | 332 | $generateProcess=new GeneratePDF($cid, $config); |
331 | 333 | dispatch($generateProcess)->onQueue('normal'); |
332 | 334 | Cache::tags(['contest', 'admin', 'PDFGenerate'])->put($cid, $generateProcess->getJobStatusId()); |
@@ -345,7 +347,9 @@ discard block |
||
345 | 347 | if ($contestModel->judgeClearance($cid, Auth::user()->id)!=3) { |
346 | 348 | return ResponseModel::err(2001); |
347 | 349 | } |
348 | - if (!is_null(Cache::tags(['contest', 'admin', 'anticheat'])->get($cid))) return ResponseModel::err(8001); |
|
350 | + if (!is_null(Cache::tags(['contest', 'admin', 'anticheat'])->get($cid))) { |
|
351 | + return ResponseModel::err(8001); |
|
352 | + } |
|
349 | 353 | if (EloquentContestModel::find($cid)->isJudgingComplete()) { |
350 | 354 | $anticheatProcess=new AntiCheat($cid); |
351 | 355 | dispatch($anticheatProcess)->onQueue('normal'); |
@@ -24,7 +24,7 @@ |
||
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) { |
@@ -103,7 +103,9 @@ |
||
103 | 103 | return $this->user->name; |
104 | 104 | }); |
105 | 105 | $grid->column("contest_name", __('admin.submissions.contest_name'))->display(function() { |
106 | - if (!is_null($this->contest)) return $this->contest->name; |
|
106 | + if (!is_null($this->contest)) { |
|
107 | + return $this->contest->name; |
|
108 | + } |
|
107 | 109 | }); |
108 | 110 | $grid->column("readable_name", __('admin.submissions.readable_name'))->display(function() { |
109 | 111 | return $this->problem->readable_name; |
@@ -65,20 +65,26 @@ discard block |
||
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 |
||
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 |
||
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 | } |