@@ -30,7 +30,7 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 | |
@@ -139,9 +139,9 @@ discard block |
||
| 139 | 139 | ->get() |
| 140 | 140 | ->toArray(); |
| 141 | 141 | if (!empty($students)) { |
| 142 | - $this->output->writeln(count($students) . 'students remaining'); |
|
| 142 | + $this->output->writeln(count($students).'students remaining'); |
|
| 143 | 143 | array_walk($students, array($this, 'clone')); |
| 144 | - } else { |
|
| 144 | + }else { |
|
| 145 | 145 | $this->output->writeln('All are generated'); |
| 146 | 146 | // exit; |
| 147 | 147 | } |
@@ -219,7 +219,7 @@ discard block |
||
| 219 | 219 | |
| 220 | 220 | //TODO implement insert student to admission table |
| 221 | 221 | $student['id'] = $sis_student['id']; |
| 222 | - $sis_student['student_id'] = $student['id']; |
|
| 222 | + $sis_student['student_id'] = $student['id']; |
|
| 223 | 223 | |
| 224 | 224 | $student = $this->setIsTakingExam($student); |
| 225 | 225 | if (count($institutionClass) == 1) { |
@@ -227,13 +227,13 @@ discard block |
||
| 227 | 227 | Institution_student::createExaminationData($student, $admissionInfo); |
| 228 | 228 | Institution_student_admission::createExaminationData($student, $admissionInfo); |
| 229 | 229 | Institution_class_student::createExaminationData($student, $admissionInfo); |
| 230 | - } else { |
|
| 230 | + }else { |
|
| 231 | 231 | Institution_student_admission::createExaminationData($student, $admissionInfo); |
| 232 | 232 | Institution_student::createExaminationData($student, $admissionInfo); |
| 233 | 233 | } |
| 234 | 234 | $this->updateStudentId($student, $sis_student); |
| 235 | 235 | // update the matched student's data |
| 236 | - } else { |
|
| 236 | + }else { |
|
| 237 | 237 | $student = $this->setIsTakingExam($student); |
| 238 | 238 | $studentData = $this->student->updateExaminationStudent($student, $matchedStudent); |
| 239 | 239 | $matchedStudent = array_merge((array) $student, $matchedStudent); |
@@ -241,9 +241,9 @@ discard block |
||
| 241 | 241 | Institution_student::updateExaminationData($studentData, $admissionInfo); |
| 242 | 242 | $this->updateStudentId($student, $studentData); |
| 243 | 243 | } |
| 244 | - } else { |
|
| 244 | + }else { |
|
| 245 | 245 | |
| 246 | - $this->output->writeln('Student ' . $student['st_no'] . ' not imorted' . $student['f_name']); |
|
| 246 | + $this->output->writeln('Student '.$student['st_no'].' not imorted'.$student['f_name']); |
|
| 247 | 247 | // $sis_student = $this->student->insertExaminationStudent($student); |
| 248 | 248 | // $institionId = Institution::insert(['name' => $student['schoolid'], 'code' => $student['schoolid']]); |
| 249 | 249 | // $institution = Institution::where('code', '=', $student['schoolid'])->first(); |
@@ -288,7 +288,7 @@ discard block |
||
| 288 | 288 | // if the same gender same DOE has more than one |
| 289 | 289 | if (!is_null($sis_users) && (count($sis_users) > 1)) { |
| 290 | 290 | $studentData = $this->searchSimilarName($student, $sis_users); |
| 291 | - } else if (!is_null($sis_users) && (count($sis_users) == 1)) { |
|
| 291 | + }else if (!is_null($sis_users) && (count($sis_users) == 1)) { |
|
| 292 | 292 | $studentData = $sis_users[0]; |
| 293 | 293 | } |
| 294 | 294 | return $studentData; |
@@ -349,15 +349,15 @@ discard block |
||
| 349 | 349 | public function updateStudentId($student, $sis_student) |
| 350 | 350 | { |
| 351 | 351 | try { |
| 352 | - $student['nsid'] = $sis_student['openemis_no']; |
|
| 352 | + $student['nsid'] = $sis_student['openemis_no']; |
|
| 353 | 353 | // add new NSID to the examinations data set |
| 354 | 354 | unset($student['id']); |
| 355 | 355 | unset($student['taking_g5_exam']); |
| 356 | 356 | unset($student['taking_al_exam']); |
| 357 | 357 | unset($student['taking_ol_exam']); |
| 358 | 358 | $this->examination_student->where('st_no', $student['st_no'])->update($student); |
| 359 | - $this->output->writeln('Updated ' . $sis_student['student_id'] . ' to NSID' . $sis_student['openemis_no']); |
|
| 360 | - } catch (\Exception $th) { |
|
| 359 | + $this->output->writeln('Updated '.$sis_student['student_id'].' to NSID'.$sis_student['openemis_no']); |
|
| 360 | + }catch (\Exception $th) { |
|
| 361 | 361 | Log::error($th); |
| 362 | 362 | } |
| 363 | 363 | } |
@@ -373,7 +373,7 @@ discard block |
||
| 373 | 373 | try { |
| 374 | 374 | (new ExaminationStudentsExport)->store('examination/student_data_with_nsid.csv'); |
| 375 | 375 | (new ExportReady($adminUser)); |
| 376 | - } catch (\Throwable $th) { |
|
| 376 | + }catch (\Throwable $th) { |
|
| 377 | 377 | //throw $th; |
| 378 | 378 | dd($th); |
| 379 | 379 | } |
@@ -383,13 +383,13 @@ discard block |
||
| 383 | 383 | public function downloadErrors() |
| 384 | 384 | { |
| 385 | 385 | |
| 386 | - $file_path = storage_path() . '/app/examination/errors.csv'; |
|
| 386 | + $file_path = storage_path().'/app/examination/errors.csv'; |
|
| 387 | 387 | return Response::download($file_path); |
| 388 | 388 | } |
| 389 | 389 | |
| 390 | 390 | public function downloadProcessedFile() |
| 391 | 391 | { |
| 392 | - $file_path = storage_path() . '/app/examination/student_data_with_nsid.csv'; |
|
| 392 | + $file_path = storage_path().'/app/examination/student_data_with_nsid.csv'; |
|
| 393 | 393 | return Response::download($file_path); |
| 394 | 394 | } |
| 395 | 395 | } |
@@ -41,8 +41,8 @@ |
||
| 41 | 41 | { |
| 42 | 42 | $output = new \Symfony\Component\Console\Output\ConsoleOutput(); |
| 43 | 43 | $output->writeln('###########################################------Inserting file records------###########################################'); |
| 44 | - $this->examinationController = new ExaminationStudentsController($this->argument('year'),$this->argument('grade')); |
|
| 45 | - $this->examinationController->doMatch($this->argument('offset'),$this->argument('limit')); |
|
| 44 | + $this->examinationController = new ExaminationStudentsController($this->argument('year'), $this->argument('grade')); |
|
| 45 | + $this->examinationController->doMatch($this->argument('offset'), $this->argument('limit')); |
|
| 46 | 46 | $this->examinationController->export(); |
| 47 | 47 | $output->writeln('###########################################------Finished inserting file records------###########################################'); |
| 48 | 48 | } |