Completed
Push — master ( c106d2...7c3edb )
by John
14s queued 10s
created
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/Babel/Install/InstallerBase.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -39,8 +39,8 @@  discard block
 block discarded – undo
39 39
             //writing database
40 40
             $this->transactionDB();
41 41
 
42
-        }catch(Throwable $e){
43
-            if ($e->getMessage()!==""){
42
+        } catch (Throwable $e) {
43
+            if ($e->getMessage()!=="") {
44 44
                 $this->command->line("\n  <bg=red;fg=white> {$e->getMessage()} </>\n");
45 45
             }
46 46
         }
@@ -59,12 +59,12 @@  discard block
 block discarded – undo
59 59
     public function __construct($class)
60 60
     {
61 61
         $this->command=$class;
62
-        $this->versionParser = new VersionConstraintParser();
62
+        $this->versionParser=new VersionConstraintParser();
63 63
     }
64 64
 
65 65
     private function parseVersion()
66 66
     {
67
-        if(empty($this->babelConfig)){
67
+        if (empty($this->babelConfig)) {
68 68
             throw new Exception('Missing babel.json Config file.');
69 69
         }
70 70
 
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
 
135 135
             DB::commit();
136 136
 
137
-        }catch(Throwable $e){
137
+        } catch (Throwable $e) {
138 138
             DB::rollback();
139 139
             if ($e->getMessage()!=="") {
140 140
                 $this->command->line("\n  <bg=red;fg=white> {$e->getMessage()} </>\n");
Please login to merge, or discard this patch.
app/Http/Controllers/Group/AdminController.php 1 patch
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.
app/Http/Controllers/Ajax/GroupAdminController.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -48,11 +48,11 @@  discard block
 block discarded – undo
48 48
 
49 49
         $groupModel=new GroupModel();
50 50
         $clearance=$groupModel->judgeClearance($all_data["gid"], Auth::user()->id);
51
-        if ($clearance < 2) {
51
+        if ($clearance<2) {
52 52
             return ResponseModel::err(7002);
53 53
         }
54
-        $tags = $groupModel->problemTags($all_data['gid'],$all_data['pid']);
55
-        if(in_array($all_data['tag'],$tags)){
54
+        $tags=$groupModel->problemTags($all_data['gid'], $all_data['pid']);
55
+        if (in_array($all_data['tag'], $tags)) {
56 56
             return ResponseModel::err(7007);
57 57
         }
58 58
 
@@ -84,9 +84,9 @@  discard block
 block discarded – undo
84 84
         $request->validate([
85 85
             'gid' => 'required|string',
86 86
         ]);
87
-        $gid = $request->input('gid');
87
+        $gid=$request->input('gid');
88 88
         $groupModel=new GroupModel();
89
-        if($groupModel->judgeClearance($gid,Auth::user()->id) < 2) {
89
+        if ($groupModel->judgeClearance($gid, Auth::user()->id)<2) {
90 90
             return ResponseModel::err(2001);
91 91
         }
92 92
         $groupModel->refreshElo($gid);
Please login to merge, or discard this patch.
app/Models/JudgerModel.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
             "oid"=>$oid,
60 60
             "available"=>1,
61 61
             "status"=>0
62
-        ])->orderBy('usage','desc')->get()->first();
62
+        ])->orderBy('usage', 'desc')->get()->first();
63 63
 
64 64
         return $serverList;
65 65
     }
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
     {
69 69
         $serverList=DB::table("judge_server")->where(["oid"=>$oid])->get()->all();
70 70
         foreach ($serverList as &$server) {
71
-            $server["status_parsed"]=is_null($server["status"])?self::$status["-1"]:self::$status[$server["status"]];
71
+            $server["status_parsed"]=is_null($server["status"]) ?self::$status["-1"] : self::$status[$server["status"]];
72 72
         }
73 73
         return $serverList;
74 74
     }
Please login to merge, or discard this patch.
app/Helpers/functions.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -63,20 +63,20 @@  discard block
 block discarded – undo
63 63
     }
64 64
 }
65 65
 
66
-if (! function_exists('babel_path')) {
66
+if (!function_exists('babel_path')) {
67 67
     /**
68 68
      * Get the path to the application folder.
69 69
      *
70 70
      * @param  string  $path
71 71
      * @return string
72 72
      */
73
-    function babel_path($path = '')
73
+    function babel_path($path='')
74 74
     {
75 75
         return app('path').DIRECTORY_SEPARATOR.'Babel'.($path ? DIRECTORY_SEPARATOR.$path : $path);
76 76
     }
77 77
 }
78 78
 
79
-if (! function_exists('glob_recursive')) {
79
+if (!function_exists('glob_recursive')) {
80 80
     /**
81 81
      * Find pathnames matching a pattern recursively.
82 82
      *
@@ -84,11 +84,11 @@  discard block
 block discarded – undo
84 84
      * @param  int     $flags   Valid flags: GLOB_MARK
85 85
      * @return array|false      an array containing the matched files/directories, an empty array if no file matched or false on error.
86 86
      */
87
-    function glob_recursive($pattern, $flags = 0)
87
+    function glob_recursive($pattern, $flags=0)
88 88
     {
89
-        $files = glob($pattern, $flags);
90
-        foreach (glob(dirname($pattern).'/*', GLOB_ONLYDIR|GLOB_NOSORT) as $dir) {
91
-            $files = array_merge($files, glob_recursive($dir.'/'.basename($pattern), $flags));
89
+        $files=glob($pattern, $flags);
90
+        foreach (glob(dirname($pattern).'/*', GLOB_ONLYDIR | GLOB_NOSORT) as $dir) {
91
+            $files=array_merge($files, glob_recursive($dir.'/'.basename($pattern), $flags));
92 92
         }
93 93
         return $files;
94 94
     }
@@ -122,8 +122,8 @@  discard block
 block discarded – undo
122 122
     function delFile($dirName)
123 123
     {
124 124
         if (file_exists($dirName) && $handle=opendir($dirName)) {
125
-            while (false!==($item = readdir($handle))) {
126
-                if ($item!= "." && $item != "..") {
125
+            while (false!==($item=readdir($handle))) {
126
+                if ($item!="." && $item!="..") {
127 127
                     if (file_exists($dirName.'/'.$item) && is_dir($dirName.'/'.$item)) {
128 128
                         delFile($dirName.'/'.$item);
129 129
                     } else {
@@ -141,6 +141,6 @@  discard block
 block discarded – undo
141 141
 if (!function_exists('convertMarkdownToHtml')) {
142 142
     function convertMarkdownToHtml($md)
143 143
     {
144
-        return is_string($md)?Markdown::convertToHtml($md):'';
144
+        return is_string($md) ?Markdown::convertToHtml($md) : '';
145 145
     }
146 146
 }
Please login to merge, or discard this patch.
app/Models/Rating/GroupRatingCalculator.php 1 patch
Spacing   +85 added lines, -85 removed lines patch added patch discarded remove patch
@@ -14,36 +14,36 @@  discard block
 block discarded – undo
14 14
     public $totParticipants=0;
15 15
     public $INITIAL_RATING=1500;
16 16
 
17
-    public function __construct($cid){
18
-        $contestModel = new ContestModel();
19
-        $this->cid = $cid;
20
-        $this->gid = $contestModel->gid($cid);
17
+    public function __construct($cid) {
18
+        $contestModel=new ContestModel();
19
+        $this->cid=$cid;
20
+        $this->gid=$contestModel->gid($cid);
21 21
         // get rank
22 22
         $this->getRecord();
23 23
     }
24 24
 
25
-    private function getRecord(){
26
-        $contestModel = new ContestModel();
27
-        $contestRankRaw = $contestModel->contestRank($this->cid);
28
-        foreach($contestRankRaw as $key => $contestRank){
29
-            if(isset($contestRank['remote']) && $contestRank['remote']){
25
+    private function getRecord() {
26
+        $contestModel=new ContestModel();
27
+        $contestRankRaw=$contestModel->contestRank($this->cid);
28
+        foreach ($contestRankRaw as $key => $contestRank) {
29
+            if (isset($contestRank['remote']) && $contestRank['remote']) {
30 30
                 unset($contestRankRaw[$key]);
31 31
             }
32 32
         }
33
-        $contestRankRaw = array_values($contestRankRaw);
34
-        $members = array_column($contestRankRaw,'uid');
35
-        $ratings_temp = DB::table('group_member')
33
+        $contestRankRaw=array_values($contestRankRaw);
34
+        $members=array_column($contestRankRaw, 'uid');
35
+        $ratings_temp=DB::table('group_member')
36 36
             ->where([
37 37
                 'gid' => $this->gid,
38
-            ])->whereIn('uid',$members)
39
-            ->select('uid','ranking')
38
+            ])->whereIn('uid', $members)
39
+            ->select('uid', 'ranking')
40 40
             ->get()->all();
41
-        $ratings = [];
41
+        $ratings=[];
42 42
         foreach ($ratings_temp as $rating) {
43
-            $ratings[$rating['uid']] = $rating['ranking'];
43
+            $ratings[$rating['uid']]=$rating['ranking'];
44 44
         }
45
-        foreach($contestRankRaw as $c){
46
-            if(!isset($ratings[$c['uid']])){
45
+        foreach ($contestRankRaw as $c) {
46
+            if (!isset($ratings[$c['uid']])) {
47 47
                 continue;
48 48
             }
49 49
             $this->contestants[]=[
@@ -52,87 +52,87 @@  discard block
 block discarded – undo
52 52
                 "rating"=>$ratings[$c['uid']],
53 53
             ];
54 54
         }
55
-        $this->totParticipants = count($this->contestants);
55
+        $this->totParticipants=count($this->contestants);
56 56
     }
57 57
 
58
-    private function reassignRank(){
58
+    private function reassignRank() {
59 59
         $this->sort("points");
60
-        $idx = 0;
61
-        $points = $this->contestants[0]["points"];
62
-        $i = 1;
63
-        while($i < $this->totParticipants){
64
-            if($this->contestants[$i]["points"] < $points){
65
-                $j = $idx;
66
-                while($j < $i){
67
-                    $this->contestants[$j]["rank"] = $i;
68
-                    $j += 1;
60
+        $idx=0;
61
+        $points=$this->contestants[0]["points"];
62
+        $i=1;
63
+        while ($i<$this->totParticipants) {
64
+            if ($this->contestants[$i]["points"]<$points) {
65
+                $j=$idx;
66
+                while ($j<$i) {
67
+                    $this->contestants[$j]["rank"]=$i;
68
+                    $j+=1;
69 69
                 }
70
-                $idx = $i;
71
-                $points = $this->contestants[$i]["points"];
70
+                $idx=$i;
71
+                $points=$this->contestants[$i]["points"];
72 72
             }
73
-            $i += 1;
73
+            $i+=1;
74 74
         }
75
-        $j = $idx;
76
-        while($j < $this->totParticipants){
77
-            $this->contestants[$j]["rank"] = $this->totParticipants;
78
-            $j += 1;
75
+        $j=$idx;
76
+        while ($j<$this->totParticipants) {
77
+            $this->contestants[$j]["rank"]=$this->totParticipants;
78
+            $j+=1;
79 79
         }
80 80
     }
81 81
 
82
-    private function getEloWinProbability($Ra, $Rb){
83
-        return 1.0 / (1 + pow(10, ($Rb-$Ra)/400.0));
82
+    private function getEloWinProbability($Ra, $Rb) {
83
+        return 1.0 / (1+pow(10, ($Rb-$Ra) / 400.0));
84 84
     }
85 85
 
86
-    private function getSeed($rating){
87
-        $result = 1.0;
88
-        foreach($this->contestants as $other){
89
-            $result += $this->getEloWinProbability($other["rating"], $rating);
86
+    private function getSeed($rating) {
87
+        $result=1.0;
88
+        foreach ($this->contestants as $other) {
89
+            $result+=$this->getEloWinProbability($other["rating"], $rating);
90 90
         }
91 91
         return $result;
92 92
     }
93 93
 
94
-    private function getRatingToRank($rank){
94
+    private function getRatingToRank($rank) {
95 95
         $left=1;
96 96
         $right=8000;
97
-        while($right - $left > 1){
98
-            $mid = floor(($right + $left)/2);
99
-            if($this->getSeed($mid) < $rank){
100
-                $right = $mid;
101
-            }else{
102
-                $left = $mid;
97
+        while ($right-$left>1) {
98
+            $mid=floor(($right+$left) / 2);
99
+            if ($this->getSeed($mid)<$rank) {
100
+                $right=$mid;
101
+            } else {
102
+                $left=$mid;
103 103
             }
104 104
         }
105 105
         return $left;
106 106
     }
107 107
 
108
-    private function sort($key){
109
-        usort($this->contestants, function ($a, $b) use ($key) {
108
+    private function sort($key) {
109
+        usort($this->contestants, function($a, $b) use ($key) {
110 110
             return $b[$key] <=> $a[$key];
111 111
         });
112 112
     }
113 113
 
114
-    public function calculate(){
115
-        if(empty($this->contestants)){
114
+    public function calculate() {
115
+        if (empty($this->contestants)) {
116 116
             return;
117 117
         }
118 118
 
119 119
         // recalc rank
120 120
         $this->reassignRank();
121 121
 
122
-        foreach($this->contestants as &$member){
123
-            $member["seed"] = 1.0;
124
-            foreach($this->contestants as $other){
125
-                if($member["uid"] != $other["uid"]){
126
-                    $member["seed"] += $this->getEloWinProbability($other["rating"], $member["rating"]);
122
+        foreach ($this->contestants as &$member) {
123
+            $member["seed"]=1.0;
124
+            foreach ($this->contestants as $other) {
125
+                if ($member["uid"]!=$other["uid"]) {
126
+                    $member["seed"]+=$this->getEloWinProbability($other["rating"], $member["rating"]);
127 127
                 }
128 128
             }
129 129
         }
130 130
         unset($member);
131 131
 
132
-        foreach($this->contestants as &$contestant){
133
-            $midRank = sqrt($contestant["rank"] * $contestant["seed"]);
134
-            $contestant["needRating"] = $this->getRatingToRank($midRank);
135
-            $contestant["delta"] = floor(($contestant["needRating"] - $contestant["rating"])/2);
132
+        foreach ($this->contestants as &$contestant) {
133
+            $midRank=sqrt($contestant["rank"] * $contestant["seed"]);
134
+            $contestant["needRating"]=$this->getRatingToRank($midRank);
135
+            $contestant["delta"]=floor(($contestant["needRating"]-$contestant["rating"]) / 2);
136 136
         }
137 137
         unset($contestant);
138 138
 
@@ -140,39 +140,39 @@  discard block
 block discarded – undo
140 140
 
141 141
         // DO some adjuct
142 142
         // Total sum should not be more than ZERO.
143
-        $sum = 0;
143
+        $sum=0;
144 144
 
145
-        foreach($this->contestants as $contestant){
146
-            $sum += $contestant["delta"];
145
+        foreach ($this->contestants as $contestant) {
146
+            $sum+=$contestant["delta"];
147 147
         }
148
-        $inc = -floor($sum / $this->totParticipants) - 1;
149
-        foreach($this->contestants as &$contestant){
150
-            $contestant["delta"] += $inc;
148
+        $inc=-floor($sum / $this->totParticipants)-1;
149
+        foreach ($this->contestants as &$contestant) {
150
+            $contestant["delta"]+=$inc;
151 151
         }
152 152
         unset($contestant);
153 153
 
154 154
         // Sum of top-4*sqrt should be adjusted to ZERO.
155 155
 
156
-        $sum = 0;
157
-        $zeroSumCount = min(intval(4*round(sqrt($this->totParticipants))), $this->totParticipants);
156
+        $sum=0;
157
+        $zeroSumCount=min(intval(4 * round(sqrt($this->totParticipants))), $this->totParticipants);
158 158
 
159
-        for($i=0;$i<$zeroSumCount;$i++){
160
-            $sum += $this->contestants[$i]["delta"];
159
+        for ($i=0; $i<$zeroSumCount; $i++) {
160
+            $sum+=$this->contestants[$i]["delta"];
161 161
         }
162 162
 
163
-        $inc = min(max(-floor($sum / $zeroSumCount), -10), 0);
163
+        $inc=min(max(-floor($sum / $zeroSumCount), -10), 0);
164 164
 
165
-        for($i=0;$i<$zeroSumCount;$i++){
166
-            $this->contestants[$i]["delta"] += $inc;
165
+        for ($i=0; $i<$zeroSumCount; $i++) {
166
+            $this->contestants[$i]["delta"]+=$inc;
167 167
         }
168 168
 
169 169
         return $this->validateDeltas();
170 170
     }
171 171
 
172
-    public function storage(){
172
+    public function storage() {
173 173
         $contestants=$this->contestants;
174
-        DB::transaction(function () use ($contestants) {
175
-            foreach($contestants as $contestant){
174
+        DB::transaction(function() use ($contestants) {
175
+            foreach ($contestants as $contestant) {
176 176
                 $newRating=$contestant["rating"]+$contestant["delta"];
177 177
                 DB::table("group_member")->where([
178 178
                     'gid' => $this->gid,
@@ -190,20 +190,20 @@  discard block
 block discarded – undo
190 190
         }, 5);
191 191
     }
192 192
 
193
-    private function validateDeltas(){
193
+    private function validateDeltas() {
194 194
         $this->sort("points");
195 195
 
196
-        for($i=0;$i<$this->totParticipants;$i++){
197
-            for($j=$i+1;$j<$this->totParticipants;$j++){
198
-                if($this->contestants[$i]["rating"] > $this->contestants[$j]["rating"]){
199
-                    if($this->contestants[$i]["rating"] + $this->contestants[$i]["delta"] < $this->contestants[$j]["rating"] + $this->contestants[$j]["delta"]){
196
+        for ($i=0; $i<$this->totParticipants; $i++) {
197
+            for ($j=$i+1; $j<$this->totParticipants; $j++) {
198
+                if ($this->contestants[$i]["rating"]>$this->contestants[$j]["rating"]) {
199
+                    if ($this->contestants[$i]["rating"]+$this->contestants[$i]["delta"]<$this->contestants[$j]["rating"]+$this->contestants[$j]["delta"]) {
200 200
                         Log::warning("First rating invariant failed: {$this->contestants[$i]["uid"]} vs. {$this->contestants[$j]["uid"]}.");
201 201
                         return false;
202 202
                     }
203 203
                 }
204 204
 
205
-                if($this->contestants[$i]["rating"] < $this->contestants[$j]["rating"]){
206
-                    if($this->contestants[$i]["delta"] < $this->contestants[$j]["delta"]){
205
+                if ($this->contestants[$i]["rating"]<$this->contestants[$j]["rating"]) {
206
+                    if ($this->contestants[$i]["delta"]<$this->contestants[$j]["delta"]) {
207 207
                         Log::warning("Second rating invariant failed: {$this->contestants[$i]["uid"]} vs.  {$this->contestants[$j]["uid"]}.");
208 208
                         return false;
209 209
                     }
Please login to merge, or discard this patch.
app/Exports/GroupAnalysisExport.php 1 patch
Spacing   +52 added lines, -52 removed lines patch added patch discarded remove patch
@@ -16,16 +16,16 @@  discard block
 block discarded – undo
16 16
     private $member_data;
17 17
     private $config;
18 18
 
19
-    public function __construct($data, $config = [])
19
+    public function __construct($data, $config=[])
20 20
     {
21
-        if ($config['mode'] == 'contest') {
22
-            $this->contest_data = $data['contest_data'];
23
-            $this->member_data = $data['member_data'];
21
+        if ($config['mode']=='contest') {
22
+            $this->contest_data=$data['contest_data'];
23
+            $this->member_data=$data['member_data'];
24 24
         } else {
25
-            $this->member_data = $data['member_data'];
26
-            $this->tag_problems = $data['tag_problems'];
25
+            $this->member_data=$data['member_data'];
26
+            $this->tag_problems=$data['tag_problems'];
27 27
         }
28
-        $this->config = $config;
28
+        $this->config=$config;
29 29
     }
30 30
 
31 31
     /**
@@ -34,9 +34,9 @@  discard block
 block discarded – undo
34 34
     public function registerEvents(): array
35 35
     {
36 36
         return [
37
-            AfterSheet::class => function (AfterSheet $event) {
38
-                if ($this->config['mode'] === 'contest') {
39
-                    $mergeCell = ['A1:A2','B1:E1'];
37
+            AfterSheet::class => function(AfterSheet $event) {
38
+                if ($this->config['mode']==='contest') {
39
+                    $mergeCell=['A1:A2', 'B1:E1'];
40 40
                     foreach ($this->contest_data as $c) {
41 41
                         array_push($mergeCell, $this->mergeCellColumnNext());
42 42
                     }
@@ -51,46 +51,46 @@  discard block
 block discarded – undo
51 51
     */
52 52
     public function collection()
53 53
     {
54
-        $maxium = $this->config['maxium'] ?? false;
55
-        $percent = $this->config['percent'] ?? false;
54
+        $maxium=$this->config['maxium'] ?? false;
55
+        $percent=$this->config['percent'] ?? false;
56 56
 
57
-        if ($this->config['mode'] == 'contest') {
58
-            $row_1 = ['Member','Total','','',''];
59
-            $row_2 = ['','Elo','Rank','Solved','Penalty'];
57
+        if ($this->config['mode']=='contest') {
58
+            $row_1=['Member', 'Total', '', '', ''];
59
+            $row_2=['', 'Elo', 'Rank', 'Solved', 'Penalty'];
60 60
             foreach ($this->contest_data as $contest) {
61
-                array_push($row_1, $contest['name'], '','');
62
-                array_push($row_2, 'Rank','Solved', 'Penalty');
61
+                array_push($row_1, $contest['name'], '', '');
62
+                array_push($row_2, 'Rank', 'Solved', 'Penalty');
63 63
             }
64
-            $data = [$row_1,$row_2];
64
+            $data=[$row_1, $row_2];
65 65
             foreach ($this->member_data as $member) {
66
-                $display_name = $member['name'];
66
+                $display_name=$member['name'];
67 67
                 if (!empty($member['nick_name'])) {
68
-                    $display_name .= ' ('.$member['nick_name'].')';
68
+                    $display_name.=' ('.$member['nick_name'].')';
69 69
                 }
70
-                $row = [
70
+                $row=[
71 71
                     $display_name,
72 72
                     $member['elo'],
73 73
                     !empty($member['rank_ave']) ? round($member['rank_ave'], 1) : '-',
74
-                    $percent === 'true'  ? ($member['problem_all'] != 0 ? round($member['solved_all'] / $member['problem_all'] * 100, 1) : '-'). ' %'
75
-                            : ($maxium === 'true'  ? $member['solved_all'] . ' / ' . $member['problem_all'] : $member['solved_all']),
74
+                    $percent==='true' ? ($member['problem_all']!=0 ? round($member['solved_all'] / $member['problem_all'] * 100, 1) : '-').' %'
75
+                            : ($maxium==='true' ? $member['solved_all'].' / '.$member['problem_all'] : $member['solved_all']),
76 76
                     round($member['penalty']),
77 77
                 ];
78 78
                 foreach ($this->contest_data as $contest) {
79 79
                     if (in_array($contest['cid'], array_keys($member['contest_detial']))) {
80
-                        $contest_detial = $member['contest_detial'][$contest['cid']];
80
+                        $contest_detial=$member['contest_detial'][$contest['cid']];
81 81
                         array_push(
82 82
                             $row,
83 83
                             $contest_detial['rank'],
84
-                            $percent === 'true' ? (round($contest_detial['solved'] / $contest_detial['problems'] * 100, 1) . ' %')
85
-                                    : ($maxium === 'true' ? $contest_detial['solved'].' / '.$contest_detial['problems'] : $contest_detial['solved']),
84
+                            $percent==='true' ? (round($contest_detial['solved'] / $contest_detial['problems'] * 100, 1).' %')
85
+                                    : ($maxium==='true' ? $contest_detial['solved'].' / '.$contest_detial['problems'] : $contest_detial['solved']),
86 86
                             round($contest_detial['penalty'])
87 87
                         );
88 88
                     } else {
89 89
                         array_push(
90 90
                             $row,
91 91
                             '-',
92
-                            $percent === 'true' ? '- %'
93
-                                    : ($maxium === 'true' ? '- / -' : ' - '),
92
+                            $percent==='true' ? '- %'
93
+                                    : ($maxium==='true' ? '- / -' : ' - '),
94 94
                             0
95 95
                         );
96 96
                     }
@@ -98,27 +98,27 @@  discard block
 block discarded – undo
98 98
                 array_push($data, $row);
99 99
             }
100 100
         } else {
101
-            $row_1 = ['Member'];
102
-            $row_2 = [''];
101
+            $row_1=['Member'];
102
+            $row_2=[''];
103 103
             foreach ($this->tag_problems as $tag => $tag_problem_set) {
104 104
                 array_push($row_1, $tag);
105 105
                 array_push($row_2, 'Solved');
106 106
             }
107
-            $data = [$row_1,$row_2];
107
+            $data=[$row_1, $row_2];
108 108
             foreach ($this->member_data as $member) {
109
-                $display_name = $member['name'];
109
+                $display_name=$member['name'];
110 110
                 if (!empty($member['nick_name'])) {
111
-                    $display_name .= ' ('.$member['nick_name'].')';
111
+                    $display_name.=' ('.$member['nick_name'].')';
112 112
                 }
113
-                $row = [
113
+                $row=[
114 114
                     $display_name,
115 115
                 ];
116 116
                 foreach ($member['completion'] as $tag => $tag_completion) {
117
-                    $count = count($tag_completion);
118
-                    $solved = eval('return '.join('+', array_values($tag_completion)).';');
117
+                    $count=count($tag_completion);
118
+                    $solved=eval('return '.join('+', array_values($tag_completion)).';');
119 119
                     array_push(
120 120
                         $row,
121
-                        $percent === 'true' ? (round($solved / $count * 100, 1) . ' %') : ($maxium  === 'true' ? $solved .' / '.$count : $solved)
121
+                        $percent==='true' ? (round($solved / $count * 100, 1).' %') : ($maxium==='true' ? $solved.' / '.$count : $solved)
122 122
                     );
123 123
                 }
124 124
                 array_push($data, $row);
@@ -129,33 +129,33 @@  discard block
 block discarded – undo
129 129
 
130 130
     private function mergeCellColumnNext()
131 131
     {
132
-        static $columns = [
133
-            [2],[4]
132
+        static $columns=[
133
+            [2], [4]
134 134
         ];
135
-        $columns_str = ['',''];
136
-        $chars = str_split('ABCDEFGHIJKLMNOPQRSTUVWXYZ');
135
+        $columns_str=['', ''];
136
+        $chars=str_split('ABCDEFGHIJKLMNOPQRSTUVWXYZ');
137 137
         foreach ($columns as $key => &$column) {
138
-            $column[0] += 3;
139
-            if ($column[0] > 25) {
138
+            $column[0]+=3;
139
+            if ($column[0]>25) {
140 140
                 if (isset($column[1])) {
141
-                    $column[1] += 1;
142
-                    if ($column[1] > 25) {
141
+                    $column[1]+=1;
142
+                    if ($column[1]>25) {
143 143
                         if (isset($column[2])) {
144
-                            $column[2] += 1;
144
+                            $column[2]+=1;
145 145
                         } else {
146
-                            $column[2] = 0;
146
+                            $column[2]=0;
147 147
                         }
148 148
                     }
149 149
                 } else {
150
-                    $column[1] = 0;
150
+                    $column[1]=0;
151 151
                 }
152 152
             }
153
-            $columns_str[$key] = '';
154
-            $reverse_column = array_reverse($column);
153
+            $columns_str[$key]='';
154
+            $reverse_column=array_reverse($column);
155 155
             foreach ($reverse_column as $ord) {
156
-                $columns_str[$key] .= $chars[$ord];
156
+                $columns_str[$key].=$chars[$ord];
157 157
             }
158
-            $columns_str[$key] .= '1';
158
+            $columns_str[$key].='1';
159 159
         }
160 160
         return $columns_str[0].':'.$columns_str[1];
161 161
     }
Please login to merge, or discard this patch.
app/Http/Controllers/Ajax/GroupController.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -69,9 +69,9 @@  discard block
 block discarded – undo
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") return ResponseModel::err(7005);
73 73
         $is_group=$groupModel->isGroup($all_data["gcode"]);
74
-        if($is_group) return ResponseModel::err(7006);
74
+        if ($is_group) return ResponseModel::err(7006);
75 75
 
76 76
         $allow_extension=['jpg', 'png', 'jpeg', 'gif', 'bmp'];
77 77
         if (!empty($request->file('img')) && $request->file('img')->isValid()) {
@@ -100,20 +100,20 @@  discard block
 block discarded – undo
100 100
 
101 101
         $groupModel=new GroupModel();
102 102
         $clearance=$groupModel->judgeClearance($all_data["gid"], Auth::user()->id);
103
-        if ($clearance > 0) {
104
-            switch($all_data['mode']){
103
+        if ($clearance>0) {
104
+            switch ($all_data['mode']) {
105 105
                 case 'contest':
106
-                    $ret = $groupModel->groupMemberPracticeContestStat($all_data["gid"]);
106
+                    $ret=$groupModel->groupMemberPracticeContestStat($all_data["gid"]);
107 107
                 break;
108 108
                 case 'tag':
109
-                    $ret = $groupModel->groupMemberPracticeTagStat($all_data["gid"]);
109
+                    $ret=$groupModel->groupMemberPracticeTagStat($all_data["gid"]);
110 110
                 break;
111 111
                 default:
112 112
                     return ResponseModel::err(1007);
113 113
                 break;
114 114
             }
115 115
 
116
-            return ResponseModel::success(200,null,$ret);
116
+            return ResponseModel::success(200, null, $ret);
117 117
         }
118 118
         return ResponseModel::err(7002);
119 119
     }
@@ -129,10 +129,10 @@  discard block
 block discarded – undo
129 129
 
130 130
         $groupModel=new GroupModel();
131 131
         $clearance=$groupModel->judgeClearance($all_data["gid"], Auth::user()->id);
132
-        if($clearance <= 0){
132
+        if ($clearance<=0) {
133 133
             return ResponseModel::err(7002);
134 134
         }
135
-        $ret = $groupModel->getEloChangeLog($all_data['gid'],$all_data['uid']);
136
-        return ResponseModel::success(200,null,$ret);
135
+        $ret=$groupModel->getEloChangeLog($all_data['gid'], $all_data['uid']);
136
+        return ResponseModel::success(200, null, $ret);
137 137
     }
138 138
 }
Please login to merge, or discard this patch.