Completed
Pull Request — master (#155)
by Corey
02:55
created
site/controllers/CheckinController.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
     if ($form->load(Yii::$app->request->post()) && $form->validate()) {
40 40
       $form->compiled_behaviors = $form->compileBehaviors();
41 41
 
42
-      if(sizeof($form->compiled_behaviors) === 0) {
42
+      if (sizeof($form->compiled_behaviors) === 0) {
43 43
         return $this->redirect(['view']);
44 44
       }
45 45
 
@@ -49,14 +49,14 @@  discard block
 block discarded – undo
49 49
 
50 50
       // delete cached scores
51 51
       $time = Yii::$container->get('common\interfaces\TimeInterface');
52
-      $key = "scores_of_last_month_".Yii::$app->user->id."_".$time->getLocalDate();
52
+      $key = "scores_of_last_month_" . Yii::$app->user->id . "_" . $time->getLocalDate();
53 53
       Yii::$app->cache->delete($key);
54 54
 
55 55
       // if the user has publicised their score graph, create the image
56
-      if(Yii::$app->user->identity->expose_graph) {
56
+      if (Yii::$app->user->identity->expose_graph) {
57 57
         $user_behavior = Yii::$container->get('common\interfaces\UserBehaviorInterface');
58 58
         $scores_last_month = $user_behavior->calculateScoresOfLastMonth();
59
-        if($scores_last_month) {
59
+        if ($scores_last_month) {
60 60
           Yii::$container
61 61
             ->get('common\components\Graph')
62 62
             ->create($scores_last_month, true);
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
     $date = Yii::$container->get('common\interfaces\TimeInterface')->getLocalDate();
82 82
 
83 83
     $user_behaviors = $user_behavior->getUserBehaviorsWithCategory($date);
84
-    if(count($user_behaviors) === 0) {
84
+    if (count($user_behaviors) === 0) {
85 85
       return $this->redirect(['view']);
86 86
     }
87 87
 
@@ -91,10 +91,10 @@  discard block
 block discarded – undo
91 91
       $form->deleteToday();
92 92
 
93 93
       $behaviors = $user_behavior->findAll($form->getUserBehaviorIds());
94
-      if($result = $form->saveAnswers($behaviors)) {
94
+      if ($result = $form->saveAnswers($behaviors)) {
95 95
 
96 96
         $score = $user_behavior->getDailyScore();
97
-        if(Yii::$app->user->identity->isOverThreshold($score)) {
97
+        if (Yii::$app->user->identity->isOverThreshold($score)) {
98 98
           Yii::$app->user->identity->sendEmailReport($date);
99 99
           Yii::$app->session->setFlash('warning', 'Your check-in is complete. A notification has been sent to your report partners because of your high score. Reach out to them!');
100 100
         } else {
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
   public function actionView($date = null)
115 115
   {
116 116
     $time = Yii::$container->get('common\interfaces\TimeInterface');
117
-    if(is_null($date)) {
117
+    if (is_null($date)) {
118 118
       $date = $time->getLocalDate();
119 119
     }
120 120
 
Please login to merge, or discard this patch.
site/views/checkin/report.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 ];
42 42
 
43 43
 $tmp_pie = [];
44
-foreach($answer_pie as $key => $category) {
44
+foreach ($answer_pie as $key => $category) {
45 45
   $json = [
46 46
     "value" => (int)$category['count'],
47 47
     "color" => $pie_colors[$key]["color"],
@@ -79,12 +79,12 @@  discard block
 block discarded – undo
79 79
                 <th>Behavior</th>
80 80
                 <th>Category</th>
81 81
             </tr>
82
-<?php foreach($top_behaviors as $key => $row) {
82
+<?php foreach ($top_behaviors as $key => $row) {
83 83
 $num = $key + 1;
84
-print "<tr>".
85
-  "<td>{$row['count']}</td>".
86
-  "<td>{$row['behavior']['name']}</td>".
87
-  "<td>{$row['behavior']['category']['name']}</td>".
84
+print "<tr>" .
85
+  "<td>{$row['count']}</td>" .
86
+  "<td>{$row['behavior']['name']}</td>" .
87
+  "<td>{$row['behavior']['category']['name']}</td>" .
88 88
   "</tr>";
89 89
 
90 90
 }
Please login to merge, or discard this patch.