Test Setup Failed
Pull Request — master (#452)
by Mohamed
07:31
created
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
 
@@ -142,9 +142,9 @@  discard block
 block discarded – undo
142 142
             ->get()
143 143
             ->toArray();
144 144
         if (!empty($students)) {
145
-            $this->output->writeln(count($students) . 'students remaining out of' . $count);
145
+            $this->output->writeln(count($students).'students remaining out of'.$count);
146 146
             array_walk($students, array($this, 'clone'));
147
-        } else {
147
+        }else {
148 148
             $this->output->writeln('All are generated');
149 149
             // exit;
150 150
         }
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
 
223 223
                 //TODO implement insert student to admission table
224 224
                 $student['id'] = $sis_student['id'];
225
-                $sis_student['student_id'] =  $student['id'];
225
+                $sis_student['student_id'] = $student['id'];
226 226
 
227 227
                 $student = $this->setIsTakingExam($student);
228 228
                 if (count($institutionClass) == 1) {
@@ -230,13 +230,13 @@  discard block
 block discarded – undo
230 230
                     Institution_student::createExaminationData($student, $admissionInfo);
231 231
                     Institution_student_admission::createExaminationData($student, $admissionInfo);
232 232
                     Institution_class_student::createExaminationData($student, $admissionInfo);
233
-                } else {
233
+                }else {
234 234
                     Institution_student_admission::createExaminationData($student, $admissionInfo);
235 235
                     Institution_student::createExaminationData($student, $admissionInfo);
236 236
                 }
237 237
                 $this->updateStudentId($student, $sis_student);
238 238
                 // update the matched student's data    
239
-            } else {
239
+            }else {
240 240
                 $student = $this->setIsTakingExam($student);
241 241
                 $studentData = $this->student->updateExaminationStudent($student, $matchedStudent);
242 242
                 $matchedStudent = array_merge((array) $student, $matchedStudent);
@@ -244,9 +244,9 @@  discard block
 block discarded – undo
244 244
                 Institution_student::updateExaminationData($studentData, $admissionInfo);
245 245
                 $this->updateStudentId($student, $studentData);
246 246
             }
247
-        } else {
247
+        }else {
248 248
 
249
-            $this->output->writeln('Student ' . $student['st_no'] . ' not imorted' . $student['f_name']);
249
+            $this->output->writeln('Student '.$student['st_no'].' not imorted'.$student['f_name']);
250 250
             // $sis_student = $this->student->insertExaminationStudent($student);
251 251
             // $institionId = Institution::insert(['name' => $student['schoolid'], 'code' => $student['schoolid']]);
252 252
             // $institution = Institution::where('code', '=', $student['schoolid'])->first();
@@ -291,7 +291,7 @@  discard block
 block discarded – undo
291 291
         // if the same gender same DOE has more than one 
292 292
         if (!is_null($sis_users) && (count($sis_users) > 1)) {
293 293
             $studentData = $this->searchSimilarName($student, $sis_users);
294
-        } else if (!is_null($sis_users) && (count($sis_users) == 1)) {
294
+        }else if (!is_null($sis_users) && (count($sis_users) == 1)) {
295 295
             $studentData = $sis_users[0];
296 296
         }
297 297
         return $studentData;
@@ -352,15 +352,15 @@  discard block
 block discarded – undo
352 352
     public function updateStudentId($student, $sis_student)
353 353
     {
354 354
         try {
355
-            $student['nsid'] =  $sis_student['openemis_no'];
355
+            $student['nsid'] = $sis_student['openemis_no'];
356 356
             // add new NSID to the examinations data set
357 357
             unset($student['id']);
358 358
             unset($student['taking_g5_exam']);
359 359
             unset($student['taking_al_exam']);
360 360
             unset($student['taking_ol_exam']);
361 361
             $this->examination_student->where('st_no', $student['st_no'])->update($student);
362
-            $this->output->writeln('Updated ' . $sis_student['student_id'] . ' to NSID' . $sis_student['openemis_no']);
363
-        } catch (\Exception $th) {
362
+            $this->output->writeln('Updated '.$sis_student['student_id'].' to NSID'.$sis_student['openemis_no']);
363
+        }catch (\Exception $th) {
364 364
             Log::error($th);
365 365
         }
366 366
     }
@@ -376,7 +376,7 @@  discard block
 block discarded – undo
376 376
         try {
377 377
             (new ExaminationStudentsExport)->store('examination/student_data_with_nsid.csv');
378 378
             (new ExportReady($adminUser));
379
-        } catch (\Throwable $th) {
379
+        }catch (\Throwable $th) {
380 380
             //throw $th;
381 381
             dd($th);
382 382
         }
@@ -386,13 +386,13 @@  discard block
 block discarded – undo
386 386
     public function downloadErrors()
387 387
     {
388 388
 
389
-        $file_path = storage_path() . '/app/examination/errors.csv';
389
+        $file_path = storage_path().'/app/examination/errors.csv';
390 390
         return Response::download($file_path);
391 391
     }
392 392
 
393 393
     public function downloadProcessedFile()
394 394
     {
395
-        $file_path = storage_path() . '/app/examination/student_data_with_nsid.csv';
395
+        $file_path = storage_path().'/app/examination/student_data_with_nsid.csv';
396 396
         return Response::download($file_path);
397 397
     }
398 398
 }
Please login to merge, or discard this patch.