Completed
Push — master ( fe59d0...35f4c4 )
by MusikAnimal
02:53 queued 02:36
created
src/AppBundle/Controller/AdminScoreController.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -47,9 +47,9 @@  discard block
 block discarded – undo
47 47
         $username = $request->query->get('username', $request->query->get('user'));
48 48
 
49 49
         if ($projectQuery != '' && $username != '') {
50
-            return $this->redirectToRoute('AdminScoreResult', [ 'project' => $projectQuery, 'username' => $username ]);
50
+            return $this->redirectToRoute('AdminScoreResult', ['project' => $projectQuery, 'username' => $username]);
51 51
         } elseif ($projectQuery != '' && $project === null) {
52
-            return $this->redirectToRoute('AdminScoreProject', [ 'project' => $projectQuery ]);
52
+            return $this->redirectToRoute('AdminScoreProject', ['project' => $projectQuery]);
53 53
         }
54 54
 
55 55
         // Set default project so we can populate the namespace selector.
@@ -96,20 +96,20 @@  discard block
 block discarded – undo
96 96
 
97 97
         // MULTIPLIERS (to review)
98 98
         $multipliers = [
99
-            'account-age-mult' => 1.25,             # 0 if = 365 jours
100
-            'edit-count-mult' => 1.25,              # 0 if = 10 000
101
-            'user-page-mult' => 0.1,                # 0 if =
102
-            'patrols-mult' => 1,                    # 0 if =
103
-            'blocks-mult' => 1.4,                   # 0 if = 10
99
+            'account-age-mult' => 1.25, # 0 if = 365 jours
100
+            'edit-count-mult' => 1.25, # 0 if = 10 000
101
+            'user-page-mult' => 0.1, # 0 if =
102
+            'patrols-mult' => 1, # 0 if =
103
+            'blocks-mult' => 1.4, # 0 if = 10
104 104
             'afd-mult' => 1.15,
105
-            'recent-activity-mult' => 0.9,          # 0 if =
105
+            'recent-activity-mult' => 0.9, # 0 if =
106 106
             'aiv-mult' => 1.15,
107
-            'edit-summaries-mult' => 0.8,           # 0 if =
108
-            'namespaces-mult' => 1.0,               # 0 if =
109
-            'pages-created-live-mult' => 1.4,       # 0 if =
110
-            'pages-created-deleted-mult' => 1.4,    # 0 if =
111
-            'rpp-mult' => 1.15,                     # 0 if =
112
-            'user-rights-mult' => 0.75,             # 0 if =
107
+            'edit-summaries-mult' => 0.8, # 0 if =
108
+            'namespaces-mult' => 1.0, # 0 if =
109
+            'pages-created-live-mult' => 1.4, # 0 if =
110
+            'pages-created-deleted-mult' => 1.4, # 0 if =
111
+            'rpp-mult' => 1.15, # 0 if =
112
+            'user-rights-mult' => 0.75, # 0 if =
113 113
         ];
114 114
 
115 115
         // Grab the connection to the replica database (which is separate from the above)
@@ -193,14 +193,14 @@  discard block
 block discarded – undo
193 193
                 $now = new DateTime();
194 194
                 $date = new DateTime($value);
195 195
                 $diff = $date->diff($now);
196
-                $formula = 365 * $diff->format("%y") + 30 * $diff->format("%m") + $diff->format("%d");
197
-                $value = $formula - 365;
196
+                $formula = 365 * $diff->format("%y")+30 * $diff->format("%m")+$diff->format("%d");
197
+                $value = $formula-365;
198 198
             }
199 199
 
200 200
             if ($key === "id") {
201 201
                 $id = $value;
202 202
             } else {
203
-                $multiplierKey = $row['source'] . '-mult';
203
+                $multiplierKey = $row['source'].'-mult';
204 204
                 $multiplier = isset($multipliers[$multiplierKey]) ? $multipliers[$multiplierKey] : 1;
205 205
                 $score = max(min($value * $multiplier, 100), -100);
206 206
                 $master[$key]["mult"] = $multiplier;
@@ -211,8 +211,8 @@  discard block
 block discarded – undo
211 211
         }
212 212
 
213 213
         if ($id == 0) {
214
-            $this->addFlash("notice", [ "no-result", $username ]);
215
-            return $this->redirectToRoute("AdminScore", [ "project" => $project ]);
214
+            $this->addFlash("notice", ["no-result", $username]);
215
+            return $this->redirectToRoute("AdminScore", ["project" => $project]);
216 216
         }
217 217
 
218 218
         return $this->render('adminscore/result.html.twig', [
Please login to merge, or discard this patch.