Test Setup Failed
Push — master ( fd217b...77b278 )
by Mohamed
19:24 queued 13:01
created
app/Http/Controllers/ExaminationStudentsController.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
         $this->grade = $grade;
29 29
         $this->student = new Security_user();
30 30
         $this->examination_student = new Examination_student();
31
-        $this->academic_period =  Academic_period::where('code', '=', $this->year)->first();
31
+        $this->academic_period = Academic_period::where('code', '=', $this->year)->first();
32 32
         $this->education_grade = Education_grade::where('code', '=', $this->grade)->first();
33 33
         $this->output = new \Symfony\Component\Console\Output\ConsoleOutput();
34 34
     }
@@ -70,10 +70,10 @@  discard block
 block discarded – undo
70 70
                     );
71 71
                     Session::flash('message', 'File upload successfully!');
72 72
                     // Redirect to index
73
-                } else {
73
+                }else {
74 74
                     Session::flash('message', 'File too large. File must be less than 20MB.');
75 75
                 }
76
-            } else {
76
+            }else {
77 77
                 Session::flash('message', 'Invalid File Extension.');
78 78
             }
79 79
         }
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
             $import->import($excelFile, 'local', \Maatwebsite\Excel\Excel::CSV);
96 96
             if ($import->failures()->count() > 0) {
97 97
                 $errors = $import->failures();
98
-                $columns =  [
98
+                $columns = [
99 99
                     'remarks',
100 100
                     'st_no',
101 101
                     'stu_no',
@@ -116,10 +116,10 @@  discard block
 block discarded – undo
116 116
                 Storage::put($file, implode(',', $columns));
117 117
 
118 118
                 foreach ($errors as $error) {
119
-                    Storage::append($file, implode(':', $error->errors()) . ',' . implode(',', $error->values()));
119
+                    Storage::append($file, implode(':', $error->errors()).','.implode(',', $error->values()));
120 120
                 }
121 121
             }
122
-        } catch (\Maatwebsite\Excel\Validators\ValidationException $e) {
122
+        }catch (\Maatwebsite\Excel\Validators\ValidationException $e) {
123 123
         }
124 124
     }
125 125
 
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
 
208 208
                 //TODO implement insert student to admission table
209 209
                 $student['id'] = $sis_student['id'];
210
-                $sis_student['student_id'] =  $student['id'];
210
+                $sis_student['student_id'] = $student['id'];
211 211
 
212 212
                 $student = $this->setIsTakingExam($student);
213 213
                 if (count($institutionClass) == 1) {
@@ -215,13 +215,13 @@  discard block
 block discarded – undo
215 215
                     Institution_student::createExaminationData($student, $admissionInfo);
216 216
                     Institution_student_admission::createExaminationData($student, $admissionInfo);
217 217
                     Institution_class_student::createExaminationData($student, $admissionInfo);
218
-                } else {
218
+                }else {
219 219
                     Institution_student_admission::createExaminationData($student, $admissionInfo);
220 220
                     Institution_student::createExaminationData($student, $admissionInfo);
221 221
                 }
222 222
                 $this->updateStudentId($student, $sis_student);
223 223
                 // update the matched student's data    
224
-            } else {
224
+            }else {
225 225
                 $student = $this->setIsTakingExam($student);
226 226
                 $studentData = $this->student->updateExaminationStudent($student, $matchedStudent);
227 227
                 $matchedStudent = array_merge((array) $student, $matchedStudent);
@@ -248,7 +248,7 @@  discard block
 block discarded – undo
248 248
         // if the same gender same DOE has more than one 
249 249
         if (!is_null($sis_users) && (count($sis_users) > 1)) {
250 250
             $studentData = $this->searchSimilarName($student, $sis_users);
251
-        }else if (!is_null($sis_users) && (count($sis_users) == 1)){
251
+        }else if (!is_null($sis_users) && (count($sis_users) == 1)) {
252 252
             $studentData = $sis_users[0];
253 253
         }
254 254
         return $studentData;
@@ -309,15 +309,15 @@  discard block
 block discarded – undo
309 309
     public function updateStudentId($student, $sis_student)
310 310
     {
311 311
         try {
312
-            $student['nsid'] =  $sis_student['openemis_no'];
312
+            $student['nsid'] = $sis_student['openemis_no'];
313 313
             // add new NSID to the examinations data set
314 314
             unset($student['id']);
315 315
             unset($studentData['taking_g5_exam']);
316 316
             unset($studentData['taking_al_exam']);
317 317
             unset($studentData['taking_ol_exam']);
318
-            $this->examination_student->where('st_no' , $student['st_no'])->update($student);
319
-            $this->output->writeln('Updated ' . $sis_student['student_id'] . ' to NSID' . $sis_student['openemis_no']);
320
-        } catch (\Exception $th) {
318
+            $this->examination_student->where('st_no', $student['st_no'])->update($student);
319
+            $this->output->writeln('Updated '.$sis_student['student_id'].' to NSID'.$sis_student['openemis_no']);
320
+        }catch (\Exception $th) {
321 321
             Log::error($th);
322 322
         }
323 323
     }
@@ -333,7 +333,7 @@  discard block
 block discarded – undo
333 333
         try {
334 334
             (new ExaminationStudentsExport)->store('examination/student_data_with_nsid.csv');
335 335
             (new ExportReady($adminUser));
336
-        } catch (\Throwable $th) {
336
+        }catch (\Throwable $th) {
337 337
             //throw $th;
338 338
             dd($th);
339 339
         }
@@ -343,13 +343,13 @@  discard block
 block discarded – undo
343 343
     public function downloadErrors()
344 344
     {
345 345
 
346
-        $file_path = storage_path() . '/app/examination/errors.csv';
346
+        $file_path = storage_path().'/app/examination/errors.csv';
347 347
         return Response::download($file_path);
348 348
     }
349 349
 
350 350
     public function downloadProcessedFile()
351 351
     {
352
-        $file_path = storage_path() . '/app/examination/student_data_with_nsid.csv';
352
+        $file_path = storage_path().'/app/examination/student_data_with_nsid.csv';
353 353
         return Response::download($file_path);
354 354
     }
355 355
 }
Please login to merge, or discard this patch.