@@ -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 | } |
@@ -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 | |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | $Institution = $Institution[0]; |
| 144 | 144 | if (count($student) == 1) { |
| 145 | 145 | $student = $student[0]; |
| 146 | - if (((int)$Institution['id']) != ((int)$student['institution_id'])) { |
|
| 146 | + if (((int) $Institution['id']) != ((int) $student['institution_id'])) { |
|
| 147 | 147 | $studentClass = Institution_class_student::where('student_id', $student['student_id']) |
| 148 | 148 | ->first(); |
| 149 | 149 | Institution_class_student::where('student_id', $student['student_id'])->delete(); |
@@ -153,12 +153,12 @@ discard block |
||
| 153 | 153 | if (!is_null($studentClass)) { |
| 154 | 154 | $class->updateClassCount($studentClass->toArray()); |
| 155 | 155 | } |
| 156 | - $output->writeln('updated student info:' . $data['nsid']); |
|
| 156 | + $output->writeln('updated student info:'.$data['nsid']); |
|
| 157 | 157 | } |
| 158 | - } else { |
|
| 158 | + }else { |
|
| 159 | 159 | Institution_student::where('institution_id', '<>', $Institution['id'])->where('student_id', $student[0]['student_id']) |
| 160 | 160 | ->delete(); |
| 161 | - $output->writeln('updated student info:' . $Institution['id'] . '==' . $Institution['id']); |
|
| 161 | + $output->writeln('updated student info:'.$Institution['id'].'=='.$Institution['id']); |
|
| 162 | 162 | } |
| 163 | 163 | } |
| 164 | 164 | } |
@@ -174,7 +174,7 @@ discard block |
||
| 174 | 174 | $students = []; |
| 175 | 175 | switch ($mode) { |
| 176 | 176 | case 'duplicate': |
| 177 | - $students = DB::table('examination_students as es') |
|
| 177 | + $students = DB::table('examination_students as es') |
|
| 178 | 178 | ->select(DB::raw('count(*) as total'), 'e2.*') |
| 179 | 179 | ->where('grade', $this->grade) |
| 180 | 180 | ->where('year', $this->year) |
@@ -186,7 +186,7 @@ discard block |
||
| 186 | 186 | ->limit($limit) |
| 187 | 187 | ->get()->toArray(); |
| 188 | 188 | $students = (array) json_decode(json_encode($students)); |
| 189 | - $this->output->writeln(count($students) . 'students remaining duplicate'); |
|
| 189 | + $this->output->writeln(count($students).'students remaining duplicate'); |
|
| 190 | 190 | array_walk($students, array($this, 'clone')); |
| 191 | 191 | $this->output->writeln('All are generated'); |
| 192 | 192 | break; |
@@ -199,7 +199,7 @@ discard block |
||
| 199 | 199 | ->limit($limit) |
| 200 | 200 | ->get()->toArray(); |
| 201 | 201 | $students = (array) json_decode(json_encode($students)); |
| 202 | - $this->output->writeln(count($students) . 'students remaining empty'); |
|
| 202 | + $this->output->writeln(count($students).'students remaining empty'); |
|
| 203 | 203 | array_walk($students, array($this, 'clone')); |
| 204 | 204 | $this->output->writeln('All are generated'); |
| 205 | 205 | break; |
@@ -209,7 +209,7 @@ discard block |
||
| 209 | 209 | ->where('year', $this->year) |
| 210 | 210 | ->get()->toArray(); |
| 211 | 211 | $students = (array) json_decode(json_encode($students)); |
| 212 | - $this->output->writeln(count($students) . 'students remaining with wrong NSID'); |
|
| 212 | + $this->output->writeln(count($students).'students remaining with wrong NSID'); |
|
| 213 | 213 | array_walk($students, array($this, 'clone')); |
| 214 | 214 | $this->output->writeln('All are generated'); |
| 215 | 215 | break; |
@@ -220,7 +220,7 @@ discard block |
||
| 220 | 220 | ->count(); |
| 221 | 221 | $all = Examination_student::select('nsid') |
| 222 | 222 | ->count(); |
| 223 | - $this->output->writeln($all . 'Total Unique nsid are: ' . $count); |
|
| 223 | + $this->output->writeln($all.'Total Unique nsid are: '.$count); |
|
| 224 | 224 | break; |
| 225 | 225 | default: |
| 226 | 226 | $students = Examination_student::offset($offset) |
@@ -229,7 +229,7 @@ discard block |
||
| 229 | 229 | ->limit($limit) |
| 230 | 230 | ->get()->toArray(); |
| 231 | 231 | $students = (array) json_decode(json_encode($students)); |
| 232 | - $this->output->writeln(count($students) . 'students remaining empty'); |
|
| 232 | + $this->output->writeln(count($students).'students remaining empty'); |
|
| 233 | 233 | array_walk($students, array($this, 'clone')); |
| 234 | 234 | $this->output->writeln('All are generated'); |
| 235 | 235 | } |
@@ -275,7 +275,7 @@ discard block |
||
| 275 | 275 | */ |
| 276 | 276 | public function clone($student) |
| 277 | 277 | { |
| 278 | - $student = (array)json_decode(json_encode($student)); |
|
| 278 | + $student = (array) json_decode(json_encode($student)); |
|
| 279 | 279 | //get student matching with same dob and gender |
| 280 | 280 | |
| 281 | 281 | $matchedStudent = $this->getMatchingStudents($student); |
@@ -310,7 +310,7 @@ discard block |
||
| 310 | 310 | |
| 311 | 311 | //TODO implement insert student to admission table |
| 312 | 312 | $student['id'] = $sis_student['id']; |
| 313 | - $sis_student['student_id'] = $student['id']; |
|
| 313 | + $sis_student['student_id'] = $student['id']; |
|
| 314 | 314 | |
| 315 | 315 | $student = $this->setIsTakingExam($student); |
| 316 | 316 | if (count($institutionClass) == 1) { |
@@ -318,13 +318,13 @@ discard block |
||
| 318 | 318 | Institution_student::createExaminationData($student, $admissionInfo); |
| 319 | 319 | Institution_student_admission::createExaminationData($student, $admissionInfo); |
| 320 | 320 | Institution_class_student::createExaminationData($student, $admissionInfo); |
| 321 | - } else { |
|
| 321 | + }else { |
|
| 322 | 322 | Institution_student_admission::createExaminationData($student, $admissionInfo); |
| 323 | 323 | Institution_student::createExaminationData($student, $admissionInfo); |
| 324 | 324 | } |
| 325 | 325 | $this->updateStudentId($student, $sis_student); |
| 326 | 326 | // update the matched student's data |
| 327 | - } else { |
|
| 327 | + }else { |
|
| 328 | 328 | $student = $this->setIsTakingExam($student); |
| 329 | 329 | $studentData = $this->student->updateExaminationStudent($student, $matchedStudent); |
| 330 | 330 | $matchedStudent = array_merge((array) $student, $matchedStudent); |
@@ -332,9 +332,9 @@ discard block |
||
| 332 | 332 | Institution_student::updateExaminationData($studentData, $admissionInfo); |
| 333 | 333 | $this->updateStudentId($student, $studentData); |
| 334 | 334 | } |
| 335 | - } else { |
|
| 335 | + }else { |
|
| 336 | 336 | |
| 337 | - $this->output->writeln('Student ' . $student['st_no'] . ' not imorted' . $student['f_name']); |
|
| 337 | + $this->output->writeln('Student '.$student['st_no'].' not imorted'.$student['f_name']); |
|
| 338 | 338 | } |
| 339 | 339 | } |
| 340 | 340 | |
@@ -351,20 +351,20 @@ discard block |
||
| 351 | 351 | /** |
| 352 | 352 | */ |
| 353 | 353 | $sis_student = $this->student->getMatches($student); |
| 354 | - $doe_students = Examination_student::where('gender', $student['gender']) |
|
| 354 | + $doe_students = Examination_student::where('gender', $student['gender']) |
|
| 355 | 355 | ->where('b_date', $student['b_date']) |
| 356 | 356 | ->where('schoolid', $student['schoolid']) |
| 357 | - ->where('year',$this->year) |
|
| 358 | - ->where('grade',$this->grade) |
|
| 357 | + ->where('year', $this->year) |
|
| 358 | + ->where('grade', $this->grade) |
|
| 359 | 359 | ->count(); |
| 360 | 360 | $count = $this->student->getStudentCount($student); |
| 361 | 361 | |
| 362 | 362 | $studentData = []; |
| 363 | - $sis_users = (array) json_decode(json_encode($sis_student), true); |
|
| 363 | + $sis_users = (array) json_decode(json_encode($sis_student), true); |
|
| 364 | 364 | // if the same gender same DOE has more than one |
| 365 | 365 | if (($doe_students > 1) || ($count > 1)) { |
| 366 | 366 | $studentData = $this->searchSimilarName($student, $sis_users, false); |
| 367 | - } else { |
|
| 367 | + }else { |
|
| 368 | 368 | $studentData = $this->searchSimilarName($student, $sis_users); |
| 369 | 369 | } |
| 370 | 370 | return $studentData; |
@@ -414,7 +414,7 @@ discard block |
||
| 414 | 414 | } |
| 415 | 415 | |
| 416 | 416 | if (count($matches) > 1) { |
| 417 | - $highest = $this->searchSimilarName($student, $sis_students, false); |
|
| 417 | + $highest = $this->searchSimilarName($student, $sis_students, false); |
|
| 418 | 418 | } |
| 419 | 419 | |
| 420 | 420 | return $highest; |
@@ -430,18 +430,18 @@ discard block |
||
| 430 | 430 | public function updateStudentId($student, $sis_student) |
| 431 | 431 | { |
| 432 | 432 | try { |
| 433 | - $student['nsid'] = $sis_student['openemis_no']; |
|
| 433 | + $student['nsid'] = $sis_student['openemis_no']; |
|
| 434 | 434 | // add new NSID to the examinations data set |
| 435 | 435 | unset($student['id']); |
| 436 | 436 | unset($student['taking_g5_exam']); |
| 437 | 437 | unset($student['taking_al_exam']); |
| 438 | 438 | unset($student['taking_ol_exam']); |
| 439 | 439 | unset($student['total']); |
| 440 | - $students['updated_at'] = now(); |
|
| 440 | + $students['updated_at'] = now(); |
|
| 441 | 441 | $this->examination_student->where('st_no', $student['st_no'])->update($student); |
| 442 | 442 | unset($student['st_no']); |
| 443 | - $this->output->writeln('Updated to NSID' . $sis_student['openemis_no']); |
|
| 444 | - } catch (\Exception $th) { |
|
| 443 | + $this->output->writeln('Updated to NSID'.$sis_student['openemis_no']); |
|
| 444 | + }catch (\Exception $th) { |
|
| 445 | 445 | dd($th); |
| 446 | 446 | $this->output->writeln('error'); |
| 447 | 447 | Log::error($th); |
@@ -457,9 +457,9 @@ discard block |
||
| 457 | 457 | { |
| 458 | 458 | $adminUser = Security_user::where('username', 'admin')->first(); |
| 459 | 459 | try { |
| 460 | - (new ExaminationStudentsExport($this->year,$this->grade))->store('examination/student_data_with_nsid.' . time() . '.csv'); |
|
| 460 | + (new ExaminationStudentsExport($this->year, $this->grade))->store('examination/student_data_with_nsid.'.time().'.csv'); |
|
| 461 | 461 | (new ExportReady($adminUser)); |
| 462 | - } catch (\Throwable $th) { |
|
| 462 | + }catch (\Throwable $th) { |
|
| 463 | 463 | //throw $th; |
| 464 | 464 | dd($th); |
| 465 | 465 | } |
@@ -469,13 +469,13 @@ discard block |
||
| 469 | 469 | public function downloadErrors() |
| 470 | 470 | { |
| 471 | 471 | |
| 472 | - $file_path = storage_path() . '/app/examination/errors.csv'; |
|
| 472 | + $file_path = storage_path().'/app/examination/errors.csv'; |
|
| 473 | 473 | return Response::download($file_path); |
| 474 | 474 | } |
| 475 | 475 | |
| 476 | 476 | public function downloadProcessedFile() |
| 477 | 477 | { |
| 478 | - $file_path = storage_path() . '/app/examination/student_data_with_nsid.csv'; |
|
| 478 | + $file_path = storage_path().'/app/examination/student_data_with_nsid.csv'; |
|
| 479 | 479 | return Response::download($file_path); |
| 480 | 480 | } |
| 481 | 481 | } |