@@ -29,7 +29,7 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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); |
@@ -238,8 +238,8 @@ discard block |
||
| 238 | 238 | Institution_student::updateExaminationData($studentData, $admissionInfo); |
| 239 | 239 | $this->updateStudentId($student, $studentData); |
| 240 | 240 | } |
| 241 | - }else{ |
|
| 242 | - $this->output->writeln('institution not found'. $student['schoolid'].' '. $student['st_no'] . 'not imported'); |
|
| 241 | + }else { |
|
| 242 | + $this->output->writeln('institution not found'.$student['schoolid'].' '.$student['st_no'].'not imported'); |
|
| 243 | 243 | } |
| 244 | 244 | } |
| 245 | 245 | |
@@ -259,7 +259,7 @@ discard block |
||
| 259 | 259 | // if the same gender same DOE has more than one |
| 260 | 260 | if (!is_null($sis_users) && (count($sis_users) > 1)) { |
| 261 | 261 | $studentData = $this->searchSimilarName($student, $sis_users); |
| 262 | - } else if (!is_null($sis_users) && (count($sis_users) == 1)) { |
|
| 262 | + }else if (!is_null($sis_users) && (count($sis_users) == 1)) { |
|
| 263 | 263 | $studentData = $sis_users[0]; |
| 264 | 264 | } |
| 265 | 265 | return $studentData; |
@@ -320,15 +320,15 @@ discard block |
||
| 320 | 320 | public function updateStudentId($student, $sis_student) |
| 321 | 321 | { |
| 322 | 322 | try { |
| 323 | - $student['nsid'] = $sis_student['openemis_no']; |
|
| 323 | + $student['nsid'] = $sis_student['openemis_no']; |
|
| 324 | 324 | // add new NSID to the examinations data set |
| 325 | 325 | unset($student['id']); |
| 326 | 326 | unset($student['taking_g5_exam']); |
| 327 | 327 | unset($student['taking_al_exam']); |
| 328 | 328 | unset($student['taking_ol_exam']); |
| 329 | 329 | $this->examination_student->where('st_no', $student['st_no'])->update($student); |
| 330 | - $this->output->writeln('Updated ' . $sis_student['student_id'] . ' to NSID' . $sis_student['openemis_no']); |
|
| 331 | - } catch (\Exception $th) { |
|
| 330 | + $this->output->writeln('Updated '.$sis_student['student_id'].' to NSID'.$sis_student['openemis_no']); |
|
| 331 | + }catch (\Exception $th) { |
|
| 332 | 332 | Log::error($th); |
| 333 | 333 | } |
| 334 | 334 | } |
@@ -344,7 +344,7 @@ discard block |
||
| 344 | 344 | try { |
| 345 | 345 | (new ExaminationStudentsExport)->store('examination/student_data_with_nsid.csv'); |
| 346 | 346 | (new ExportReady($adminUser)); |
| 347 | - } catch (\Throwable $th) { |
|
| 347 | + }catch (\Throwable $th) { |
|
| 348 | 348 | //throw $th; |
| 349 | 349 | dd($th); |
| 350 | 350 | } |
@@ -354,13 +354,13 @@ discard block |
||
| 354 | 354 | public function downloadErrors() |
| 355 | 355 | { |
| 356 | 356 | |
| 357 | - $file_path = storage_path() . '/app/examination/errors.csv'; |
|
| 357 | + $file_path = storage_path().'/app/examination/errors.csv'; |
|
| 358 | 358 | return Response::download($file_path); |
| 359 | 359 | } |
| 360 | 360 | |
| 361 | 361 | public function downloadProcessedFile() |
| 362 | 362 | { |
| 363 | - $file_path = storage_path() . '/app/examination/student_data_with_nsid.csv'; |
|
| 363 | + $file_path = storage_path().'/app/examination/student_data_with_nsid.csv'; |
|
| 364 | 364 | return Response::download($file_path); |
| 365 | 365 | } |
| 366 | 366 | } |
@@ -138,7 +138,7 @@ discard block |
||
| 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 | } |
@@ -238,7 +238,7 @@ discard block |
||
| 238 | 238 | Institution_student::updateExaminationData($studentData, $admissionInfo); |
| 239 | 239 | $this->updateStudentId($student, $studentData); |
| 240 | 240 | } |
| 241 | - }else{ |
|
| 241 | + } else{ |
|
| 242 | 242 | $this->output->writeln('institution not found'. $student['schoolid'].' '. $student['st_no'] . 'not imported'); |
| 243 | 243 | } |
| 244 | 244 | } |