Test Setup Failed
Push — master ( ff533d...33262c )
by Mohamed
31:48 queued 18:00
created
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
             // in case of duplication of the Unique ID this will recursive.
225 225
             $this->updateExaminationStudent($student, $sis_student);
Please login to merge, or discard this patch.
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
                 $studentData = $this->student->updateExaminationStudent($student, $matchedStudent);
226 226
                 $matchedStudent = array_merge((array) $student, $matchedStudent);
227 227
                 $studentData = array_merge((array) $matchedStudent, $studentData);
@@ -247,7 +247,7 @@  discard block
 block discarded – undo
247 247
         // if the same gender same DOE has more than one 
248 248
         if (!is_null($sis_users) && (count($sis_users) > 1)) {
249 249
             $studentData = $this->searchSimilarName($student, $sis_users);
250
-        }else if (!is_null($sis_users) && (count($sis_users) == 1)){
250
+        }else if (!is_null($sis_users) && (count($sis_users) == 1)) {
251 251
             $studentData = $sis_users[0];
252 252
         }
253 253
         return $studentData;
@@ -308,13 +308,13 @@  discard block
 block discarded – undo
308 308
     public function updateStudentId($student, $sis_student)
309 309
     {
310 310
         try {
311
-            $student['nsid'] =  $sis_student['openemis_no'];
311
+            $student['nsid'] = $sis_student['openemis_no'];
312 312
             // add new NSID to the examinations data set
313 313
             unset($student['id']);
314 314
             unset($studentData['taking_g5_exam']);
315
-            $this->examination_student->where('st_no' , $student['st_no'])->update($student);
316
-            $this->output->writeln('Updated ' . $sis_student['student_id'] . ' to NSID' . $sis_student['openemis_no']);
317
-        } catch (\Exception $th) {
315
+            $this->examination_student->where('st_no', $student['st_no'])->update($student);
316
+            $this->output->writeln('Updated '.$sis_student['student_id'].' to NSID'.$sis_student['openemis_no']);
317
+        }catch (\Exception $th) {
318 318
             Log::error($th);
319 319
         }
320 320
     }
@@ -330,7 +330,7 @@  discard block
 block discarded – undo
330 330
         try {
331 331
             (new ExaminationStudentsExport)->store('examination/student_data_with_nsid.csv');
332 332
             (new ExportReady($adminUser));
333
-        } catch (\Throwable $th) {
333
+        }catch (\Throwable $th) {
334 334
             //throw $th;
335 335
             dd($th);
336 336
         }
@@ -340,13 +340,13 @@  discard block
 block discarded – undo
340 340
     public function downloadErrors()
341 341
     {
342 342
 
343
-        $file_path = storage_path() . '/app/examination/errors.csv';
343
+        $file_path = storage_path().'/app/examination/errors.csv';
344 344
         return Response::download($file_path);
345 345
     }
346 346
 
347 347
     public function downloadProcessedFile()
348 348
     {
349
-        $file_path = storage_path() . '/app/examination/student_data_with_nsid.csv';
349
+        $file_path = storage_path().'/app/examination/student_data_with_nsid.csv';
350 350
         return Response::download($file_path);
351 351
     }
352 352
 }
Please login to merge, or discard this patch.