Test Setup Failed
Pull Request — master (#449)
by Mohamed
10:25 queued 03:31
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
 
@@ -135,10 +135,10 @@  discard block
 block discarded – undo
135 135
             whereNull('nsid')
136 136
         ->get()
137 137
         ->toArray();
138
-        if(!empty($students)){
139
-            $this->output->writeln(count($students). 'students remaining');
138
+        if (!empty($students)) {
139
+            $this->output->writeln(count($students).'students remaining');
140 140
             array_walk($students, array($this, 'clone'));
141
-        }else{
141
+        }else {
142 142
             $this->output->writeln('All are generated');
143 143
             exit;
144 144
         }
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
 
217 217
                 //TODO implement insert student to admission table
218 218
                 $student['id'] = $sis_student['id'];
219
-                $sis_student['student_id'] =  $student['id'];
219
+                $sis_student['student_id'] = $student['id'];
220 220
 
221 221
                 $student = $this->setIsTakingExam($student);
222 222
                 if (count($institutionClass) == 1) {
@@ -224,13 +224,13 @@  discard block
 block discarded – undo
224 224
                     Institution_student::createExaminationData($student, $admissionInfo);
225 225
                     Institution_student_admission::createExaminationData($student, $admissionInfo);
226 226
                     Institution_class_student::createExaminationData($student, $admissionInfo);
227
-                } else {
227
+                }else {
228 228
                     Institution_student_admission::createExaminationData($student, $admissionInfo);
229 229
                     Institution_student::createExaminationData($student, $admissionInfo);
230 230
                 }
231 231
                 $this->updateStudentId($student, $sis_student);
232 232
                 // update the matched student's data    
233
-            } else {
233
+            }else {
234 234
                 $student = $this->setIsTakingExam($student);
235 235
                 $studentData = $this->student->updateExaminationStudent($student, $matchedStudent);
236 236
                 $matchedStudent = array_merge((array) $student, $matchedStudent);
@@ -257,7 +257,7 @@  discard block
 block discarded – undo
257 257
         // if the same gender same DOE has more than one 
258 258
         if (!is_null($sis_users) && (count($sis_users) > 1)) {
259 259
             $studentData = $this->searchSimilarName($student, $sis_users);
260
-        } else if (!is_null($sis_users) && (count($sis_users) == 1)) {
260
+        }else if (!is_null($sis_users) && (count($sis_users) == 1)) {
261 261
             $studentData = $sis_users[0];
262 262
         }
263 263
         return $studentData;
@@ -318,15 +318,15 @@  discard block
 block discarded – undo
318 318
     public function updateStudentId($student, $sis_student)
319 319
     {
320 320
         try {
321
-            $student['nsid'] =  $sis_student['openemis_no'];
321
+            $student['nsid'] = $sis_student['openemis_no'];
322 322
             // add new NSID to the examinations data set
323 323
             unset($student['id']);
324 324
             unset($student['taking_g5_exam']);
325 325
             unset($student['taking_al_exam']);
326 326
             unset($student['taking_ol_exam']);
327 327
             $this->examination_student->where('st_no', $student['st_no'])->update($student);
328
-            $this->output->writeln('Updated ' . $sis_student['student_id'] . ' to NSID' . $sis_student['openemis_no']);
329
-        } catch (\Exception $th) {
328
+            $this->output->writeln('Updated '.$sis_student['student_id'].' to NSID'.$sis_student['openemis_no']);
329
+        }catch (\Exception $th) {
330 330
             Log::error($th);
331 331
         }
332 332
     }
@@ -342,7 +342,7 @@  discard block
 block discarded – undo
342 342
         try {
343 343
             (new ExaminationStudentsExport)->store('examination/student_data_with_nsid.csv');
344 344
             (new ExportReady($adminUser));
345
-        } catch (\Throwable $th) {
345
+        }catch (\Throwable $th) {
346 346
             //throw $th;
347 347
             dd($th);
348 348
         }
@@ -352,13 +352,13 @@  discard block
 block discarded – undo
352 352
     public function downloadErrors()
353 353
     {
354 354
 
355
-        $file_path = storage_path() . '/app/examination/errors.csv';
355
+        $file_path = storage_path().'/app/examination/errors.csv';
356 356
         return Response::download($file_path);
357 357
     }
358 358
 
359 359
     public function downloadProcessedFile()
360 360
     {
361
-        $file_path = storage_path() . '/app/examination/student_data_with_nsid.csv';
361
+        $file_path = storage_path().'/app/examination/student_data_with_nsid.csv';
362 362
         return Response::download($file_path);
363 363
     }
364 364
 }
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -138,7 +138,7 @@
 block discarded – undo
138 138
         if(!empty($students)){
139 139
             $this->output->writeln(count($students). 'students remaining');
140 140
             array_walk($students, array($this, 'clone'));
141
-        }else{
141
+        } else{
142 142
             $this->output->writeln('All are generated');
143 143
             exit;
144 144
         }
Please login to merge, or discard this patch.