Test Setup Failed
Pull Request — master (#451)
by Mohamed
08:40
created
app/Console/Commands/CloneConfigData.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -64,7 +64,7 @@
 block discarded – undo
64 64
 
65 65
 
66 66
         $this->output->writeln('$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$');
67
-        $this->output->writeln('The cook took ' . ($this->end_time - $this->start_time) . ' seconds to complete');
67
+        $this->output->writeln('The cook took '.($this->end_time - $this->start_time).' seconds to complete');
68 68
         $this->output->writeln('$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$');
69 69
     }  
70 70
 }
Please login to merge, or discard this patch.
app/Console/Commands/cleanClone.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -53,32 +53,32 @@
 block discarded – undo
53 53
         $this->start_time = microtime(TRUE);
54 54
         $year = $this->argument('year');
55 55
         $academicPeriod = $this->academic_period->getAcademicPeriod($year);
56
-        if($year <= 2019) {
56
+        if ($year <= 2019) {
57 57
             $this->output->writeln('2019 or previous data not allowed to delete from this script');
58 58
             exit();
59 59
         }
60
-        $shift = $this->shifts->getShiftsToDelete($year,$academicPeriod->id);
61
-        array_walk($shift,array($this,'process'));
60
+        $shift = $this->shifts->getShiftsToDelete($year, $academicPeriod->id);
61
+        array_walk($shift, array($this, 'process'));
62 62
 
63
-        $this->output->writeln('The cook took ' . ($this->end_time - $this->start_time) . ' seconds to complete');
63
+        $this->output->writeln('The cook took '.($this->end_time - $this->start_time).' seconds to complete');
64 64
         $this->output->writeln('$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$');
65 65
  
66 66
        
67 67
     }
68 68
 
69
-    public function process($shift){
69
+    public function process($shift) {
70 70
        
71 71
     try {
72
-        $institutionClasses = $this->institution_classes->select('id')->where('id',$shift['id']);
73
-        $this->institution_classes->where('id',$shift['id'])->delete();
72
+        $institutionClasses = $this->institution_classes->select('id')->where('id', $shift['id']);
73
+        $this->institution_classes->where('id', $shift['id'])->delete();
74 74
  
75
-        $this->institution_class_subjects->whereIn('id',$institutionClasses)->delete();
75
+        $this->institution_class_subjects->whereIn('id', $institutionClasses)->delete();
76 76
  
77
-        $this->shifts->where('id',$shift['id'])->delete();
77
+        $this->shifts->where('id', $shift['id'])->delete();
78 78
  
79
-        $this->output->writeln('Deleted '. $shift['id'] . ($this->end_time - $this->start_time) . ' seconds to complete');
79
+        $this->output->writeln('Deleted '.$shift['id'].($this->end_time - $this->start_time).' seconds to complete');
80 80
  
81
-    } catch (\Throwable $th) {
81
+    }catch (\Throwable $th) {
82 82
         dd($th);
83 83
     }
84 84
       
Please login to merge, or discard this patch.
app/Console/Commands/UpdateStudentsCount.php 2 patches
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -27,11 +27,11 @@
 block discarded – undo
27 27
      */
28 28
     protected $description = 'Update the students count male/female';
29 29
 
30
-      /**
31
-     * Create a new command instance.
32
-     *
33
-     * @return void
34
-     */
30
+        /**
31
+         * Create a new command instance.
32
+         *
33
+         * @return void
34
+         */
35 35
     public function __construct()
36 36
     {
37 37
         parent::__construct();
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -46,16 +46,16 @@
 block discarded – undo
46 46
     public function handle()
47 47
     {
48 48
         $classes = Institution_class::get()->toArray();
49
-        $this->output->writeln('start updating:'. count($classes));
49
+        $this->output->writeln('start updating:'.count($classes));
50 50
         $this->output->writeln('#########################################');
51
-        array_walk($classes , array($this,'updateCount'));
52
-        $this->output->writeln('start finish:'. count($classes));
51
+        array_walk($classes, array($this, 'updateCount'));
52
+        $this->output->writeln('start finish:'.count($classes));
53 53
         $this->output->writeln('#########################################');
54 54
     }
55 55
 
56
-    public function updateCount($class){
57
-        $this->output->writeln('updating:'. $class['id']);
58
-        $totalStudents =  Institution_class_student::getStudentsCount($class['id']);
56
+    public function updateCount($class) {
57
+        $this->output->writeln('updating:'.$class['id']);
58
+        $totalStudents = Institution_class_student::getStudentsCount($class['id']);
59 59
         Institution_class::where('id', '=', $class['id'])
60 60
         ->update([
61 61
             'total_male_students' => $totalStudents['total_male_students'],
Please login to merge, or discard this patch.
app/Console/Commands/ImportStudents.php 2 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -137,9 +137,9 @@
 block discarded – undo
137 137
             ->join('user_contacts', 'uploads.security_user_id', '=', 'user_contacts.security_user_id')
138 138
             ->join('contact_types', 'user_contacts.contact_type_id', '=', 'contact_types.id')
139 139
             //only for UAT
140
-             ->where('contact_types.contact_option_id', '=', 5)
140
+                ->where('contact_types.contact_option_id', '=', 5)
141 141
 //            ->where('contact_types.contact_option_id', '!=', 5)
142
-             ->where('contact_types.name', '=', 'TestEmail')
142
+                ->where('contact_types.name', '=', 'TestEmail')
143 143
             ->limit(1)
144 144
             ->get()->toArray();
145 145
         $node = $this->argument('node');
Please login to merge, or discard this patch.
Spacing   +52 added lines, -52 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
      */
48 48
     public function __construct()
49 49
     {
50
-        $this->output =  new \Symfony\Component\Console\Output\ConsoleOutput();
50
+        $this->output = new \Symfony\Component\Console\Output\ConsoleOutput();
51 51
         parent::__construct();
52 52
     }
53 53
 
@@ -69,18 +69,18 @@  discard block
 block discarded – undo
69 69
                         $this->process($files);
70 70
                         unset($files);
71 71
                         exit();
72
-                    } else {
72
+                    }else {
73 73
                         $output = new \Symfony\Component\Console\Output\ConsoleOutput();
74 74
                         $this->output->writeln('No files found,Waiting for files');
75 75
                         exit();
76 76
                     }
77
-                } catch (Exception $e) {
77
+                }catch (Exception $e) {
78 78
                     $output = new \Symfony\Component\Console\Output\ConsoleOutput();
79 79
                     $this->output->writeln($e);
80 80
                     sleep(300);
81 81
                     $this->handle();
82 82
                 }
83
-            } else {
83
+            }else {
84 84
                 exit();
85 85
             }
86 86
         }
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
         $files[0]['node'] = $node;
96 96
         $this->processSheet($files[0]);
97 97
         $now = Carbon::now()->tz('Asia/Colombo');
98
-        $this->output->writeln('=============== Time taken to batch ' . $now->diffInMinutes($time));
98
+        $this->output->writeln('=============== Time taken to batch '.$now->diffInMinutes($time));
99 99
     }
100 100
 
101 101
     protected function getTerminatedFiles()
@@ -167,13 +167,13 @@  discard block
 block discarded – undo
167 167
     public function processSuccessEmail($file, $user, $subject)
168 168
     {
169 169
         $file['subject'] = $subject;
170
-        $this->output->writeln('Processing the file: ' . $file['filename']);
170
+        $this->output->writeln('Processing the file: '.$file['filename']);
171 171
         try {
172 172
             Mail::to($user->email)->send(new StudentImportSuccess($file));
173 173
             DB::table('uploads')
174 174
                 ->where('id', $file['id'])
175 175
                 ->update(['is_processed' => 1, 'is_email_sent' => 1, 'updated_at' => now()]);
176
-        } catch (\Exception $ex) {
176
+        }catch (\Exception $ex) {
177 177
             $this->output->writeln($ex->getMessage());
178 178
             DB::table('uploads')
179 179
                 ->where('id', $file['id'])
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
             DB::table('uploads')
190 190
                 ->where('id', $file['id'])
191 191
                 ->update(['is_processed' => 2, 'is_email_sent' => 1, 'updated_at' => now()]);
192
-        } catch (\Exception $ex) {
192
+        }catch (\Exception $ex) {
193 193
             $this->output->writeln($ex->getMessage());
194 194
             DB::table('uploads')
195 195
                 ->where('id', $file['id'])
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
             DB::table('uploads')
206 206
                 ->where('id', $file['id'])
207 207
                 ->update(['is_processed' => 2, 'is_email_sent' => 1, 'updated_at' => now()]);
208
-        } catch (\Exception $ex) {
208
+        }catch (\Exception $ex) {
209 209
             $this->output->writeln($ex->getMessage());
210 210
             DB::table('uploads')
211 211
                 ->where('id', $file['id'])
@@ -218,9 +218,9 @@  discard block
 block discarded – undo
218 218
         $node = $this->argument('node');
219 219
         if ($node == $file['node']) {
220 220
             $output = new \Symfony\Component\Console\Output\ConsoleOutput();
221
-            $this->output->writeln('Processing from:' . $node);
221
+            $this->output->writeln('Processing from:'.$node);
222 222
             return true;
223
-        } else {
223
+        }else {
224 224
             exit;
225 225
             return false;
226 226
         }
@@ -232,20 +232,20 @@  discard block
 block discarded – undo
232 232
         $user = User::find($file['security_user_id']);
233 233
         $this->checkNode($file);
234 234
         $this->output->writeln('##########################################################################################################################');
235
-        $this->output->writeln('Processing the file: ' . $file['filename']);
235
+        $this->output->writeln('Processing the file: '.$file['filename']);
236 236
         if ($this->checkTime()) {
237 237
             try {
238 238
                 $this->import($file, 1, 'C');
239 239
                 sleep(10);
240 240
                 $this->import($file, 2, 'B');
241
-            } catch (\Maatwebsite\Excel\Validators\ValidationException $e) {
241
+            }catch (\Maatwebsite\Excel\Validators\ValidationException $e) {
242 242
                 $this->output->writeln($e->getMessage());
243 243
                 try {
244 244
                     Mail::to($user->email)->send(new IncorrectTemplate($file));
245 245
                     DB::table('uploads')
246 246
                         ->where('id', $file['id'])
247 247
                         ->update(['is_processed' => 2, 'is_email_sent' => 1, 'updated_at' => now()]);
248
-                } catch (\Exception $ex) {
248
+                }catch (\Exception $ex) {
249 249
                     $this->output->writeln($e->getMessage());
250 250
                     $this->handle();
251 251
                     DB::table('uploads')
@@ -253,15 +253,15 @@  discard block
 block discarded – undo
253 253
                         ->update(['is_processed' => 2, 'is_email_sent' => 2, 'updated_at' => now()]);
254 254
                 }
255 255
             }
256
-        } else {
256
+        }else {
257 257
             exit();
258 258
         }
259 259
     }
260 260
 
261 261
     protected function getType($file)
262 262
     {
263
-        $file =  storage_path() . '/app/sis-bulk-data-files/' . $file;
264
-        $inputFileType =  \PhpOffice\PhpSpreadsheet\IOFactory::identify($file);
263
+        $file = storage_path().'/app/sis-bulk-data-files/'.$file;
264
+        $inputFileType = \PhpOffice\PhpSpreadsheet\IOFactory::identify($file);
265 265
         return $inputFileType;
266 266
     }
267 267
 
@@ -322,7 +322,7 @@  discard block
 block discarded – undo
322 322
             ini_set('memory_limit', '2048M');
323 323
             $this->getFileSize($file);
324 324
             $user = User::find($file['security_user_id']);
325
-            $excelFile = '/sis-bulk-data-files/' . $file['filename'];
325
+            $excelFile = '/sis-bulk-data-files/'.$file['filename'];
326 326
             $this->higestRow = $this->getHigestRow($file, $sheet, $column);
327 327
             switch ($sheet) {
328 328
                 case 1;
@@ -341,11 +341,11 @@  discard block
 block discarded – undo
341 341
                                 ->update(['insert' => 3, 'updated_at' => now()]);
342 342
                             $this->processFailedEmail($file, $user, 'Fresh Student Data Upload:Partial Success ');
343 343
                             $this->stdOut('Insert Students', $this->higestRow);
344
-                        } else {
344
+                        }else {
345 345
                             $this->processSuccessEmail($file, $user, 'Fresh Student Data Upload:Success ');
346 346
                             $this->stdOut('Insert Students', $this->higestRow);
347 347
                         }
348
-                    } else if (($this->getSheetName($file, 'Insert Students')) && $this->higestRow > 0) {
348
+                    }else if (($this->getSheetName($file, 'Insert Students')) && $this->higestRow > 0) {
349 349
                         DB::table('uploads')
350 350
                             ->where('id', $file['id'])
351 351
                             ->update(['is_processed' => 2]);
@@ -367,11 +367,11 @@  discard block
 block discarded – undo
367 367
                                 ->update(['update' => 3, 'is_processed' => 1, 'updated_at' => now()]);
368 368
                             $this->processFailedEmail($file, $user, 'Existing Student Data Update:Partial Success ');
369 369
                             $this->stdOut('Update Students', $this->higestRow);
370
-                        } else {
370
+                        }else {
371 371
                             $this->processSuccessEmail($file, $user, 'Existing Student Data Update:Success ');
372 372
                             $this->stdOut('Update Students', $this->higestRow);
373 373
                         }
374
-                    } else if (($this->getSheetName($file, 'Update Students')) && $this->higestRow == 0) {
374
+                    }else if (($this->getSheetName($file, 'Update Students')) && $this->higestRow == 0) {
375 375
                         DB::table('uploads')
376 376
                             ->where('id', $file['id'])
377 377
                             ->update(['is_processed' => 2, 'updated_at' => now()]);
@@ -379,7 +379,7 @@  discard block
 block discarded – undo
379 379
                     }
380 380
                     break;
381 381
             }
382
-        } catch (\Maatwebsite\Excel\Validators\ValidationException $e) {
382
+        }catch (\Maatwebsite\Excel\Validators\ValidationException $e) {
383 383
             $this->output->writeln($e->getMessage());
384 384
             if ($sheet == 1) {
385 385
                 self::writeErrors($e, $file, 'Insert Students');
@@ -387,7 +387,7 @@  discard block
 block discarded – undo
387 387
                     ->where('id', $file['id'])
388 388
                     ->update(['insert' => 2, 'updated_at' => now()]);
389 389
                 $this->processFailedEmail($file, $user, 'Fresh Student Data Upload:Failed');
390
-            } else if ($sheet == 2) {
390
+            }else if ($sheet == 2) {
391 391
                 self::writeErrors($e, $file, 'Update Students');
392 392
                 DB::table('uploads')
393 393
                     ->where('id', $file['id'])
@@ -395,7 +395,7 @@  discard block
 block discarded – undo
395 395
                 $this->processFailedEmail($file, $user, 'Existing Student Data Update:Failed');
396 396
             }
397 397
             DB::table('uploads')
398
-                ->where('id',  $file['id'])
398
+                ->where('id', $file['id'])
399 399
                 ->update(['is_processed' => 2, 'updated_at' => now()]);
400 400
         }
401 401
     }
@@ -413,14 +413,14 @@  discard block
 block discarded – undo
413 413
 
414 414
     protected function  getFileSize($file)
415 415
     {
416
-        $excelFile =  '/sis-bulk-data-files/' . $file['filename'];
416
+        $excelFile = '/sis-bulk-data-files/'.$file['filename'];
417 417
         $size = Storage::disk('local')->size($excelFile);
418 418
         $user = User::find($file['security_user_id']);
419 419
         if ($size > 0) {
420 420
             return true;
421
-        } else {
421
+        }else {
422 422
             DB::table('uploads')
423
-                ->where('id',  $file['id'])
423
+                ->where('id', $file['id'])
424 424
                 ->update(['is_processed' => 2, 'updated_at' => now()]);
425 425
             $this->stdOut('No valid data found :Please re-upload the file', 0);
426 426
             $this->processEmptyEmail($file, $user, 'No valid data found :Please re-upload the file');
@@ -430,21 +430,21 @@  discard block
 block discarded – undo
430 430
     protected function setReader($file)
431 431
     {
432 432
         try {
433
-            $excelFile =  '/sis-bulk-data-files/processed/' . $file['filename'];
433
+            $excelFile = '/sis-bulk-data-files/processed/'.$file['filename'];
434 434
             $exists = Storage::disk('local')->exists($excelFile);
435 435
             if (!$exists) {
436 436
 
437
-                $excelFile =  "/sis-bulk-data-files/" . $file['filename'];
437
+                $excelFile = "/sis-bulk-data-files/".$file['filename'];
438 438
             }
439
-            $excelFile = storage_path() . "/app" . $excelFile;
439
+            $excelFile = storage_path()."/app".$excelFile;
440 440
             $reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader($this->getType($file['filename']));
441
-            $objPHPExcel =  $reader->load($excelFile);
441
+            $objPHPExcel = $reader->load($excelFile);
442 442
             return $objPHPExcel;
443
-        } catch (Exception $e) {
443
+        }catch (Exception $e) {
444 444
             $this->output->writeln($e->getMessage());
445 445
             $user = User::find($file['security_user_id']);
446 446
             DB::table('uploads')
447
-                ->where('id',  $file['id'])
447
+                ->where('id', $file['id'])
448 448
                 ->update(['is_processed' => 2, 'updated_at' => now()]);
449 449
             $this->stdOut('No valid data found :Please re-upload the file', 0);
450 450
             $this->processEmptyEmail($file, $user, 'No valid data found :Please re-upload the file');
@@ -455,12 +455,12 @@  discard block
 block discarded – undo
455 455
     {
456 456
         try {;
457 457
             $objPHPExcel = $this->setReader($file);
458
-            return $objPHPExcel->getSheetByName($sheet)  !== null;
459
-        } catch (Exception $e) {
458
+            return $objPHPExcel->getSheetByName($sheet) !== null;
459
+        }catch (Exception $e) {
460 460
             $this->output->writeln($e->getMessage());
461 461
             $user = User::find($file['security_user_id']);
462 462
             DB::table('uploads')
463
-                ->where('id',  $file['id'])
463
+                ->where('id', $file['id'])
464 464
                 ->update(['is_processed' => 2, 'updated_at' => now()]);
465 465
             $this->stdOut('No valid data found :Please re-upload the file', 0);
466 466
             $this->processEmptyEmail($file, $user, 'No valid data found :Please re-upload the file');
@@ -473,17 +473,17 @@  discard block
 block discarded – undo
473 473
             $reader = $this->setReader($file);
474 474
             $reader->setActiveSheetIndex($sheet);
475 475
             $higestRow = 0;
476
-            $highestRow =  $reader->getActiveSheet()->getHighestRow($column);
476
+            $highestRow = $reader->getActiveSheet()->getHighestRow($column);
477 477
             for ($row = 3; $row <= $highestRow; $row++) {
478
-                $rowData = $reader->getActiveSheet()->getCell($column . $row)->getValue();
478
+                $rowData = $reader->getActiveSheet()->getCell($column.$row)->getValue();
479 479
                 if (empty($rowData) || $rowData == null) {
480 480
                     continue;
481
-                } else {
481
+                }else {
482 482
                     $higestRow += 1;
483 483
                 }
484 484
             }
485 485
             return $higestRow;
486
-        } catch (\Exception $e) {
486
+        }catch (\Exception $e) {
487 487
             $this->output->writeln($e->getMessage());
488 488
             $user = User::find($file['security_user_id']);
489 489
             DB::beginTransaction();
@@ -498,10 +498,10 @@  discard block
 block discarded – undo
498 498
 
499 499
     protected function stdOut($title, $rows)
500 500
     {
501
-        $this->output->writeln($title . ' Process completed at . ' . ' ' . now());
501
+        $this->output->writeln($title.' Process completed at . '.' '.now());
502 502
         $now = Carbon::now()->tz('Asia/Colombo');
503
-        $this->output->writeln('Total Processed lines: ' . $rows);
504
-        $this->output->writeln('Time taken to process           : ' .   $now->diffInSeconds($this->startTime) . ' Seconds');
503
+        $this->output->writeln('Total Processed lines: '.$rows);
504
+        $this->output->writeln('Time taken to process           : '.$now->diffInSeconds($this->startTime).' Seconds');
505 505
         $this->output->writeln('--------------------------------------------------------------------------------------------------------------------------');
506 506
     }
507 507
 
@@ -513,7 +513,7 @@  discard block
 block discarded – undo
513 513
         $sheet = $reader->getActiveSheet();
514 514
         if (!in_array($row, $params['rows'])) {
515 515
             $output = new \Symfony\Component\Console\Output\ConsoleOutput();
516
-            $this->output->writeln(' removing row . ' . ' ' . $row);
516
+            $this->output->writeln(' removing row . '.' '.$row);
517 517
             $reader->getActiveSheet()->getCellCollection()->removeRow($row);
518 518
         }
519 519
     }
@@ -539,7 +539,7 @@  discard block
 block discarded – undo
539 539
             if (count($failures) > 0) {
540 540
                 $rows = array_map('rows', $failures);
541 541
                 $rows = array_unique($rows);
542
-                $rowIndex =   range(3, $this->higestRow + 2);
542
+                $rowIndex = range(3, $this->higestRow + 2);
543 543
                 $params = [
544 544
                     'rows' => $rows,
545 545
                     'reader' => $reader
@@ -548,17 +548,17 @@  discard block
 block discarded – undo
548 548
                 array_walk($rowIndex, array($this, 'removeRows'), $params);
549 549
                 $objWriter = $this->getSheetWriter($file, $reader);
550 550
                 Storage::disk('local')->makeDirectory('sis-bulk-data-files/processed');
551
-                $objWriter->save(storage_path() . '/app/sis-bulk-data-files/processed/' . $file['filename']);
551
+                $objWriter->save(storage_path().'/app/sis-bulk-data-files/processed/'.$file['filename']);
552 552
                 $now = Carbon::now()->tz('Asia/Colombo');
553
-                $this->output->writeln($reader->getActiveSheet()->getTitle() . ' Process completed at . ' . ' ' . now());
554
-                $this->output->writeln('memory usage for the processes : ' . (memory_get_usage() - $baseMemory));
555
-                $this->output->writeln('Time taken to process           : ' .   $now->diffInSeconds($this->startTime) . ' Seconds');
556
-                $this->output->writeln(' errors reported               : ' . count($failures));
553
+                $this->output->writeln($reader->getActiveSheet()->getTitle().' Process completed at . '.' '.now());
554
+                $this->output->writeln('memory usage for the processes : '.(memory_get_usage() - $baseMemory));
555
+                $this->output->writeln('Time taken to process           : '.$now->diffInSeconds($this->startTime).' Seconds');
556
+                $this->output->writeln(' errors reported               : '.count($failures));
557 557
                 $this->output->writeln('--------------------------------------------------------------------------------------------------------------------------');
558 558
                 unset($objWriter);
559 559
                 unset($failures);
560 560
             }
561
-        } catch (Eception $e) {
561
+        }catch (Eception $e) {
562 562
             $this->output->writeln($e->getMessage());
563 563
             $user = User::find($file['security_user_id']);
564 564
             DB::beginTransaction();
Please login to merge, or discard this patch.
app/Console/Commands/UpdateViews.php 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -39,7 +39,7 @@
 block discarded – undo
39 39
      */
40 40
     public function handle()
41 41
     {
42
-       $views = new DashboardViewsController();
43
-       $views->callback();
42
+        $views = new DashboardViewsController();
43
+        $views->callback();
44 44
     }
45 45
 }
Please login to merge, or discard this patch.
app/Console/Commands/cleanConfig.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -52,9 +52,9 @@
 block discarded – undo
52 52
             'academic_period' => $academicPeriod
53 53
         ];
54 54
 
55
-        if($year <= 2019){
55
+        if ($year <= 2019) {
56 56
             die('Academic Year 2019 or earlier can`t be deleted');
57
-        }else{
57
+        }else {
58 58
             $this->clone->cleanConfig($params);
59 59
         }
60 60
     }
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -54,7 +54,7 @@
 block discarded – undo
54 54
 
55 55
         if($year <= 2019){
56 56
             die('Academic Year 2019 or earlier can`t be deleted');
57
-        }else{
57
+        } else{
58 58
             $this->clone->cleanConfig($params);
59 59
         }
60 60
     }
Please login to merge, or discard this patch.
app/Models/Security_user.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
             $studentData['id'] = $id;
182 182
             $this->uniqueUserId->updateOrInsertRecord($studentData);
183 183
             return $studentData;
184
-        } catch (\Exception $th) {
184
+        }catch (\Exception $th) {
185 185
             Log::error($th->getMessage());
186 186
             // in case of duplication of the Unique ID this will recursive.
187 187
             $this->insertExaminationStudent($student);
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
         $this->uniqueUserId = new Unique_user_id();
202 202
         $this->uniqueUId = new UniqueUid();
203 203
         // regenerate unique id if it's not available
204
-        $uniqueId = ($this->uniqueUId::isValidUniqueId($sis_student['openemis_no'],9)) ?  $sis_student['openemis_no'] : $this->uniqueUId::getUniqueAlphanumeric();
204
+        $uniqueId = ($this->uniqueUId::isValidUniqueId($sis_student['openemis_no'], 9)) ? $sis_student['openemis_no'] : $this->uniqueUId::getUniqueAlphanumeric();
205 205
 
206 206
         $studentData = [
207 207
             'username' => str_replace('-', '', $uniqueId),
@@ -215,11 +215,11 @@  discard block
 block discarded – undo
215 215
         ];
216 216
 
217 217
         try {
218
-            self::where( 'id'  , $sis_student['student_id'])->update($studentData);
218
+            self::where('id', $sis_student['student_id'])->update($studentData);
219 219
             $studentData['id'] = $sis_student['student_id'];
220 220
             $this->uniqueUserId->updateOrInsertRecord($studentData);
221 221
             return $studentData;
222
-        } catch (\Exception $th) {
222
+        }catch (\Exception $th) {
223 223
             Log::error($th);
224 224
             $this->uniqe = false;
225 225
             // in case of duplication of the Unique ID this will recursive.
Please login to merge, or discard this patch.
app/Http/Controllers/ExaminationStudentsController.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
         $this->grade = $grade;
31 31
         $this->student = new Security_user();
32 32
         $this->examination_student = new Examination_student();
33
-        $this->academic_period =  Academic_period::where('code', '=', $this->year)->first();
33
+        $this->academic_period = Academic_period::where('code', '=', $this->year)->first();
34 34
         $this->education_grade = Education_grade::where('code', '=', $this->grade)->first();
35 35
         $this->output = new \Symfony\Component\Console\Output\ConsoleOutput();
36 36
     }
@@ -72,10 +72,10 @@  discard block
 block discarded – undo
72 72
                     );
73 73
                     Session::flash('message', 'File upload successfully!');
74 74
                     // Redirect to index
75
-                } else {
75
+                }else {
76 76
                     Session::flash('message', 'File too large. File must be less than 20MB.');
77 77
                 }
78
-            } else {
78
+            }else {
79 79
                 Session::flash('message', 'Invalid File Extension.');
80 80
             }
81 81
         }
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
             $import->import($excelFile, 'local', \Maatwebsite\Excel\Excel::CSV);
98 98
             if ($import->failures()->count() > 0) {
99 99
                 $errors = $import->failures();
100
-                $columns =  [
100
+                $columns = [
101 101
                     'remarks',
102 102
                     'st_no',
103 103
                     'stu_no',
@@ -118,10 +118,10 @@  discard block
 block discarded – undo
118 118
                 Storage::put($file, implode(',', $columns));
119 119
 
120 120
                 foreach ($errors as $error) {
121
-                    Storage::append($file, implode(':', $error->errors()) . ',' . implode(',', $error->values()));
121
+                    Storage::append($file, implode(':', $error->errors()).','.implode(',', $error->values()));
122 122
                 }
123 123
             }
124
-        } catch (\Maatwebsite\Excel\Validators\ValidationException $e) {
124
+        }catch (\Maatwebsite\Excel\Validators\ValidationException $e) {
125 125
         }
126 126
     }
127 127
 
@@ -139,9 +139,9 @@  discard block
 block discarded – undo
139 139
             ->get()
140 140
             ->toArray();
141 141
         if (!empty($students)) {
142
-            $this->output->writeln(count($students) . 'students remaining');
142
+            $this->output->writeln(count($students).'students remaining');
143 143
             array_walk($students, array($this, 'clone'));
144
-        } else {
144
+        }else {
145 145
             $this->output->writeln('All are generated');
146 146
             // exit;
147 147
         }
@@ -219,7 +219,7 @@  discard block
 block discarded – undo
219 219
 
220 220
                 //TODO implement insert student to admission table
221 221
                 $student['id'] = $sis_student['id'];
222
-                $sis_student['student_id'] =  $student['id'];
222
+                $sis_student['student_id'] = $student['id'];
223 223
 
224 224
                 $student = $this->setIsTakingExam($student);
225 225
                 if (count($institutionClass) == 1) {
@@ -227,13 +227,13 @@  discard block
 block discarded – undo
227 227
                     Institution_student::createExaminationData($student, $admissionInfo);
228 228
                     Institution_student_admission::createExaminationData($student, $admissionInfo);
229 229
                     Institution_class_student::createExaminationData($student, $admissionInfo);
230
-                } else {
230
+                }else {
231 231
                     Institution_student_admission::createExaminationData($student, $admissionInfo);
232 232
                     Institution_student::createExaminationData($student, $admissionInfo);
233 233
                 }
234 234
                 $this->updateStudentId($student, $sis_student);
235 235
                 // update the matched student's data    
236
-            } else {
236
+            }else {
237 237
                 $student = $this->setIsTakingExam($student);
238 238
                 $studentData = $this->student->updateExaminationStudent($student, $matchedStudent);
239 239
                 $matchedStudent = array_merge((array) $student, $matchedStudent);
@@ -241,9 +241,9 @@  discard block
 block discarded – undo
241 241
                 Institution_student::updateExaminationData($studentData, $admissionInfo);
242 242
                 $this->updateStudentId($student, $studentData);
243 243
             }
244
-        } else {
244
+        }else {
245 245
 
246
-            $this->output->writeln('Student ' . $student['st_no'] . ' not imorted' . $student['f_name']);
246
+            $this->output->writeln('Student '.$student['st_no'].' not imorted'.$student['f_name']);
247 247
             // $sis_student = $this->student->insertExaminationStudent($student);
248 248
             // $institionId = Institution::insert(['name' => $student['schoolid'], 'code' => $student['schoolid']]);
249 249
             // $institution = Institution::where('code', '=', $student['schoolid'])->first();
@@ -288,7 +288,7 @@  discard block
 block discarded – undo
288 288
         // if the same gender same DOE has more than one 
289 289
         if (!is_null($sis_users) && (count($sis_users) > 1)) {
290 290
             $studentData = $this->searchSimilarName($student, $sis_users);
291
-        } else if (!is_null($sis_users) && (count($sis_users) == 1)) {
291
+        }else if (!is_null($sis_users) && (count($sis_users) == 1)) {
292 292
             $studentData = $sis_users[0];
293 293
         }
294 294
         return $studentData;
@@ -349,15 +349,15 @@  discard block
 block discarded – undo
349 349
     public function updateStudentId($student, $sis_student)
350 350
     {
351 351
         try {
352
-            $student['nsid'] =  $sis_student['openemis_no'];
352
+            $student['nsid'] = $sis_student['openemis_no'];
353 353
             // add new NSID to the examinations data set
354 354
             unset($student['id']);
355 355
             unset($student['taking_g5_exam']);
356 356
             unset($student['taking_al_exam']);
357 357
             unset($student['taking_ol_exam']);
358 358
             $this->examination_student->where('st_no', $student['st_no'])->update($student);
359
-            $this->output->writeln('Updated ' . $sis_student['student_id'] . ' to NSID' . $sis_student['openemis_no']);
360
-        } catch (\Exception $th) {
359
+            $this->output->writeln('Updated '.$sis_student['student_id'].' to NSID'.$sis_student['openemis_no']);
360
+        }catch (\Exception $th) {
361 361
             Log::error($th);
362 362
         }
363 363
     }
@@ -373,7 +373,7 @@  discard block
 block discarded – undo
373 373
         try {
374 374
             (new ExaminationStudentsExport)->store('examination/student_data_with_nsid.csv');
375 375
             (new ExportReady($adminUser));
376
-        } catch (\Throwable $th) {
376
+        }catch (\Throwable $th) {
377 377
             //throw $th;
378 378
             dd($th);
379 379
         }
@@ -383,13 +383,13 @@  discard block
 block discarded – undo
383 383
     public function downloadErrors()
384 384
     {
385 385
 
386
-        $file_path = storage_path() . '/app/examination/errors.csv';
386
+        $file_path = storage_path().'/app/examination/errors.csv';
387 387
         return Response::download($file_path);
388 388
     }
389 389
 
390 390
     public function downloadProcessedFile()
391 391
     {
392
-        $file_path = storage_path() . '/app/examination/student_data_with_nsid.csv';
392
+        $file_path = storage_path().'/app/examination/student_data_with_nsid.csv';
393 393
         return Response::download($file_path);
394 394
     }
395 395
 }
Please login to merge, or discard this patch.
app/Console/Commands/ExaminationStudentMigrate.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -41,8 +41,8 @@
 block discarded – undo
41 41
     {
42 42
         $output = new \Symfony\Component\Console\Output\ConsoleOutput();
43 43
         $output->writeln('###########################################------Inserting file records------###########################################');
44
-        $this->examinationController = new ExaminationStudentsController($this->argument('year'),$this->argument('grade'));
45
-        $this->examinationController->doMatch($this->argument('offset'),$this->argument('limit'));
44
+        $this->examinationController = new ExaminationStudentsController($this->argument('year'), $this->argument('grade'));
45
+        $this->examinationController->doMatch($this->argument('offset'), $this->argument('limit'));
46 46
         $this->examinationController->export();
47 47
         $output->writeln('###########################################------Finished inserting file records------###########################################');
48 48
     }
Please login to merge, or discard this patch.