Test Setup Failed
Push — master ( 70d832...998964 )
by Mohamed
08:08 queued 01:48
created
app/Http/Controllers/ExaminationStudentsController.php 2 patches
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
         $this->grade = $grade;
30 30
         $this->student = new Security_user();
31 31
         $this->examination_student = new Examination_student();
32
-        $this->academic_period =  Academic_period::where('code', '=', $this->year)->first();
32
+        $this->academic_period = Academic_period::where('code', '=', $this->year)->first();
33 33
         $this->education_grade = Education_grade::where('code', '=', $this->grade)->first();
34 34
         $this->output = new \Symfony\Component\Console\Output\ConsoleOutput();
35 35
     }
@@ -71,10 +71,10 @@  discard block
 block discarded – undo
71 71
                     );
72 72
                     Session::flash('message', 'File upload successfully!');
73 73
                     // Redirect to index
74
-                } else {
74
+                }else {
75 75
                     Session::flash('message', 'File too large. File must be less than 20MB.');
76 76
                 }
77
-            } else {
77
+            }else {
78 78
                 Session::flash('message', 'Invalid File Extension.');
79 79
             }
80 80
         }
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
             $import->import($excelFile, 'local', \Maatwebsite\Excel\Excel::CSV);
97 97
             if ($import->failures()->count() > 0) {
98 98
                 $errors = $import->failures();
99
-                $columns =  [
99
+                $columns = [
100 100
                     'remarks',
101 101
                     'st_no',
102 102
                     'stu_no',
@@ -117,10 +117,10 @@  discard block
 block discarded – undo
117 117
                 Storage::put($file, implode(',', $columns));
118 118
 
119 119
                 foreach ($errors as $error) {
120
-                    Storage::append($file, implode(':', $error->errors()) . ',' . implode(',', $error->values()));
120
+                    Storage::append($file, implode(':', $error->errors()).','.implode(',', $error->values()));
121 121
                 }
122 122
             }
123
-        } catch (\Maatwebsite\Excel\Validators\ValidationException $e) {
123
+        }catch (\Maatwebsite\Excel\Validators\ValidationException $e) {
124 124
         }
125 125
     }
126 126
 
@@ -132,12 +132,12 @@  discard block
 block discarded – undo
132 132
     public  function doMatch()
133 133
     {
134 134
         $students = Examination_student::
135
-            where('nsid','=','')
135
+            where('nsid', '=', '')
136 136
         ->get()
137 137
         ->toArray();
138
-        if(!empty($students)){
138
+        if (!empty($students)) {
139 139
             array_walk($students, array($this, 'clone'));
140
-        }else{
140
+        }else {
141 141
             $this->output->writeln('All are generated');
142 142
             exit;
143 143
         }
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
 
216 216
                 //TODO implement insert student to admission table
217 217
                 $student['id'] = $sis_student['id'];
218
-                $sis_student['student_id'] =  $student['id'];
218
+                $sis_student['student_id'] = $student['id'];
219 219
 
220 220
                 $student = $this->setIsTakingExam($student);
221 221
                 if (count($institutionClass) == 1) {
@@ -223,13 +223,13 @@  discard block
 block discarded – undo
223 223
                     Institution_student::createExaminationData($student, $admissionInfo);
224 224
                     Institution_student_admission::createExaminationData($student, $admissionInfo);
225 225
                     Institution_class_student::createExaminationData($student, $admissionInfo);
226
-                } else {
226
+                }else {
227 227
                     Institution_student_admission::createExaminationData($student, $admissionInfo);
228 228
                     Institution_student::createExaminationData($student, $admissionInfo);
229 229
                 }
230 230
                 $this->updateStudentId($student, $sis_student);
231 231
                 // update the matched student's data    
232
-            } else {
232
+            }else {
233 233
                 $student = $this->setIsTakingExam($student);
234 234
                 $studentData = $this->student->updateExaminationStudent($student, $matchedStudent);
235 235
                 $matchedStudent = array_merge((array) $student, $matchedStudent);
@@ -256,7 +256,7 @@  discard block
 block discarded – undo
256 256
         // if the same gender same DOE has more than one 
257 257
         if (!is_null($sis_users) && (count($sis_users) > 1)) {
258 258
             $studentData = $this->searchSimilarName($student, $sis_users);
259
-        } else if (!is_null($sis_users) && (count($sis_users) == 1)) {
259
+        }else if (!is_null($sis_users) && (count($sis_users) == 1)) {
260 260
             $studentData = $sis_users[0];
261 261
         }
262 262
         return $studentData;
@@ -317,15 +317,15 @@  discard block
 block discarded – undo
317 317
     public function updateStudentId($student, $sis_student)
318 318
     {
319 319
         try {
320
-            $student['nsid'] =  $sis_student['openemis_no'];
320
+            $student['nsid'] = $sis_student['openemis_no'];
321 321
             // add new NSID to the examinations data set
322 322
             unset($student['id']);
323 323
             unset($student['taking_g5_exam']);
324 324
             unset($student['taking_al_exam']);
325 325
             unset($student['taking_ol_exam']);
326 326
             $this->examination_student->where('st_no', $student['st_no'])->update($student);
327
-            $this->output->writeln('Updated ' . $sis_student['student_id'] . ' to NSID' . $sis_student['openemis_no']);
328
-        } catch (\Exception $th) {
327
+            $this->output->writeln('Updated '.$sis_student['student_id'].' to NSID'.$sis_student['openemis_no']);
328
+        }catch (\Exception $th) {
329 329
             Log::error($th);
330 330
         }
331 331
     }
@@ -341,7 +341,7 @@  discard block
 block discarded – undo
341 341
         try {
342 342
             (new ExaminationStudentsExport)->store('examination/student_data_with_nsid.csv');
343 343
             (new ExportReady($adminUser));
344
-        } catch (\Throwable $th) {
344
+        }catch (\Throwable $th) {
345 345
             //throw $th;
346 346
             dd($th);
347 347
         }
@@ -351,13 +351,13 @@  discard block
 block discarded – undo
351 351
     public function downloadErrors()
352 352
     {
353 353
 
354
-        $file_path = storage_path() . '/app/examination/errors.csv';
354
+        $file_path = storage_path().'/app/examination/errors.csv';
355 355
         return Response::download($file_path);
356 356
     }
357 357
 
358 358
     public function downloadProcessedFile()
359 359
     {
360
-        $file_path = storage_path() . '/app/examination/student_data_with_nsid.csv';
360
+        $file_path = storage_path().'/app/examination/student_data_with_nsid.csv';
361 361
         return Response::download($file_path);
362 362
     }
363 363
 }
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -137,7 +137,7 @@
 block discarded – undo
137 137
         ->toArray();
138 138
         if(!empty($students)){
139 139
             array_walk($students, array($this, 'clone'));
140
-        }else{
140
+        } else{
141 141
             $this->output->writeln('All are generated');
142 142
             exit;
143 143
         }
Please login to merge, or discard this patch.