@@ -152,12 +152,12 @@ |
||
152 | 152 | ->get()->toArray(); |
153 | 153 | } |
154 | 154 | |
155 | - /** |
|
156 | - * First level search for students |
|
157 | - * |
|
158 | - * @param array $student |
|
159 | - * @return array |
|
160 | - */ |
|
155 | + /** |
|
156 | + * First level search for students |
|
157 | + * |
|
158 | + * @param array $student |
|
159 | + * @return array |
|
160 | + */ |
|
161 | 161 | public function getStudentCount($student) |
162 | 162 | { |
163 | 163 | return $this |
@@ -144,9 +144,9 @@ discard block |
||
144 | 144 | public function getMatches($student) |
145 | 145 | { |
146 | 146 | return $this |
147 | - ->where('gender_id',$student['gender'] + 1) |
|
148 | - ->where('institutions.code',$student['schoolid']) |
|
149 | - ->where('date_of_birth',$student['b_date']) |
|
147 | + ->where('gender_id', $student['gender'] + 1) |
|
148 | + ->where('institutions.code', $student['schoolid']) |
|
149 | + ->where('date_of_birth', $student['b_date']) |
|
150 | 150 | ->join('institution_students', 'security_users.id', 'institution_students.student_id') |
151 | 151 | ->join('institutions', 'institution_students.institution_id', 'institutions.id') |
152 | 152 | ->get()->toArray(); |
@@ -161,9 +161,9 @@ discard block |
||
161 | 161 | public function getStudentCount($student) |
162 | 162 | { |
163 | 163 | return $this |
164 | - ->where('gender_id',$student['gender'] + 1) |
|
165 | - ->where('institutions.code',$student['schoolid']) |
|
166 | - ->where('date_of_birth',$student['b_date']) |
|
164 | + ->where('gender_id', $student['gender'] + 1) |
|
165 | + ->where('institutions.code', $student['schoolid']) |
|
166 | + ->where('date_of_birth', $student['b_date']) |
|
167 | 167 | ->join('institution_students', 'security_users.id', 'institution_students.student_id') |
168 | 168 | ->join('institutions', 'institution_students.institution_id', 'institutions.id') |
169 | 169 | ->count(); |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | $studentData['id'] = $id; |
198 | 198 | $this->uniqueUserId->updateOrInsertRecord($studentData); |
199 | 199 | return $studentData; |
200 | - } catch (\Exception $th) { |
|
200 | + }catch (\Exception $th) { |
|
201 | 201 | Log::error($th->getMessage()); |
202 | 202 | // in case of duplication of the Unique ID this will recursive. |
203 | 203 | $this->insertExaminationStudent($student); |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | $this->uniqueUserId = new Unique_user_id(); |
218 | 218 | $this->uniqueUId = new UniqueUid(); |
219 | 219 | // regenerate unique id if it's not available |
220 | - $uniqueId = ($this->uniqueUId::isValidUniqueId($sis_student['openemis_no'],9)) ? $sis_student['openemis_no'] : $this->uniqueUId::getUniqueAlphanumeric(); |
|
220 | + $uniqueId = ($this->uniqueUId::isValidUniqueId($sis_student['openemis_no'], 9)) ? $sis_student['openemis_no'] : $this->uniqueUId::getUniqueAlphanumeric(); |
|
221 | 221 | |
222 | 222 | $studentData = [ |
223 | 223 | 'username' => str_replace('-', '', $uniqueId), |
@@ -231,11 +231,11 @@ discard block |
||
231 | 231 | ]; |
232 | 232 | |
233 | 233 | try { |
234 | - self::where( 'id' , $sis_student['student_id'])->update($studentData); |
|
234 | + self::where('id', $sis_student['student_id'])->update($studentData); |
|
235 | 235 | $studentData['id'] = $sis_student['student_id']; |
236 | 236 | $this->uniqueUserId->updateOrInsertRecord($studentData); |
237 | 237 | return $studentData; |
238 | - } catch (\Exception $th) { |
|
238 | + }catch (\Exception $th) { |
|
239 | 239 | Log::error($th); |
240 | 240 | // in case of duplication of the Unique ID this will recursive. |
241 | 241 | $sis_student['openemis_no'] = $this->uniqueUId::getUniqueAlphanumeric(); |
@@ -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 | |
@@ -135,9 +135,9 @@ discard block |
||
135 | 135 | $students = []; |
136 | 136 | switch ($mode) { |
137 | 137 | case 'duplicate': |
138 | - $students = DB::table('examination_students as es') |
|
138 | + $students = DB::table('examination_students as es') |
|
139 | 139 | ->select(DB::raw('count(*) as total'), 'e2.*') |
140 | - ->join('examination_students as e2', 'es.nsid','e2.nsid') |
|
140 | + ->join('examination_students as e2', 'es.nsid', 'e2.nsid') |
|
141 | 141 | ->having('total', '>', 1) |
142 | 142 | ->groupBy('e2.st_no') |
143 | 143 | ->orderBy('e2.st_no') |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | ->limit($limit) |
146 | 146 | ->get()->toArray(); |
147 | 147 | $students = (array) json_decode(json_encode($students)); |
148 | - $this->output->writeln(count($students) . 'students remaining duplicate'); |
|
148 | + $this->output->writeln(count($students).'students remaining duplicate'); |
|
149 | 149 | array_walk($students, array($this, 'clone')); |
150 | 150 | $this->output->writeln('All are generated'); |
151 | 151 | break; |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | ->limit($limit) |
157 | 157 | ->get()->toArray(); |
158 | 158 | $students = (array) json_decode(json_encode($students)); |
159 | - $this->output->writeln(count($students) . 'students remaining empty'); |
|
159 | + $this->output->writeln(count($students).'students remaining empty'); |
|
160 | 160 | array_walk($students, array($this, 'clone')); |
161 | 161 | $this->output->writeln('All are generated'); |
162 | 162 | break; |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | ->limit($limit) |
166 | 166 | ->get()->toArray(); |
167 | 167 | $students = (array) json_decode(json_encode($students)); |
168 | - $this->output->writeln(count($students) . 'students remaining empty'); |
|
168 | + $this->output->writeln(count($students).'students remaining empty'); |
|
169 | 169 | array_walk($students, array($this, 'clone')); |
170 | 170 | $this->output->writeln('All are generated'); |
171 | 171 | } |
@@ -211,7 +211,7 @@ discard block |
||
211 | 211 | */ |
212 | 212 | public function clone($student) |
213 | 213 | { |
214 | - $student = (array)json_decode(json_encode($student)); |
|
214 | + $student = (array) json_decode(json_encode($student)); |
|
215 | 215 | //get student matching with same dob and gender |
216 | 216 | |
217 | 217 | $matchedStudent = $this->getMatchingStudents($student); |
@@ -244,7 +244,7 @@ discard block |
||
244 | 244 | |
245 | 245 | //TODO implement insert student to admission table |
246 | 246 | $student['id'] = $sis_student['id']; |
247 | - $sis_student['student_id'] = $student['id']; |
|
247 | + $sis_student['student_id'] = $student['id']; |
|
248 | 248 | |
249 | 249 | $student = $this->setIsTakingExam($student); |
250 | 250 | if (count($institutionClass) == 1) { |
@@ -252,13 +252,13 @@ discard block |
||
252 | 252 | Institution_student::createExaminationData($student, $admissionInfo); |
253 | 253 | Institution_student_admission::createExaminationData($student, $admissionInfo); |
254 | 254 | Institution_class_student::createExaminationData($student, $admissionInfo); |
255 | - } else { |
|
255 | + }else { |
|
256 | 256 | Institution_student_admission::createExaminationData($student, $admissionInfo); |
257 | 257 | Institution_student::createExaminationData($student, $admissionInfo); |
258 | 258 | } |
259 | 259 | $this->updateStudentId($student, $sis_student); |
260 | 260 | // update the matched student's data |
261 | - } else { |
|
261 | + }else { |
|
262 | 262 | $student = $this->setIsTakingExam($student); |
263 | 263 | $studentData = $this->student->updateExaminationStudent($student, $matchedStudent); |
264 | 264 | $matchedStudent = array_merge((array) $student, $matchedStudent); |
@@ -266,9 +266,9 @@ discard block |
||
266 | 266 | Institution_student::updateExaminationData($studentData, $admissionInfo); |
267 | 267 | $this->updateStudentId($student, $studentData); |
268 | 268 | } |
269 | - } else { |
|
269 | + }else { |
|
270 | 270 | |
271 | - $this->output->writeln('Student ' . $student['st_no'] . ' not imorted' . $student['f_name']); |
|
271 | + $this->output->writeln('Student '.$student['st_no'].' not imorted'.$student['f_name']); |
|
272 | 272 | } |
273 | 273 | } |
274 | 274 | |
@@ -286,7 +286,7 @@ discard block |
||
286 | 286 | $count = $this->student->getStudentCount($student); |
287 | 287 | |
288 | 288 | $studentData = []; |
289 | - $sis_users = (array) json_decode(json_encode($sis_student), true); |
|
289 | + $sis_users = (array) json_decode(json_encode($sis_student), true); |
|
290 | 290 | // if the same gender same DOE has more than one |
291 | 291 | $studentData = $this->searchSimilarName($student, $sis_users); |
292 | 292 | return $studentData; |
@@ -342,7 +342,7 @@ discard block |
||
342 | 342 | public function updateStudentId($student, $sis_student) |
343 | 343 | { |
344 | 344 | try { |
345 | - $student['nsid'] = $sis_student['openemis_no']; |
|
345 | + $student['nsid'] = $sis_student['openemis_no']; |
|
346 | 346 | // add new NSID to the examinations data set |
347 | 347 | unset($student['id']); |
348 | 348 | unset($student['taking_g5_exam']); |
@@ -351,8 +351,8 @@ discard block |
||
351 | 351 | unset($student['total']); |
352 | 352 | $this->examination_student->where('st_no', $student['st_no'])->update($student); |
353 | 353 | unset($student['st_no']); |
354 | - $this->output->writeln('Updated to NSID' . $sis_student['openemis_no']); |
|
355 | - } catch (\Exception $th) { |
|
354 | + $this->output->writeln('Updated to NSID'.$sis_student['openemis_no']); |
|
355 | + }catch (\Exception $th) { |
|
356 | 356 | dd($th); |
357 | 357 | $this->output->writeln('error'); |
358 | 358 | Log::error($th); |
@@ -370,7 +370,7 @@ discard block |
||
370 | 370 | try { |
371 | 371 | (new ExaminationStudentsExport)->store('examination/student_data_with_nsid.csv'); |
372 | 372 | (new ExportReady($adminUser)); |
373 | - } catch (\Throwable $th) { |
|
373 | + }catch (\Throwable $th) { |
|
374 | 374 | //throw $th; |
375 | 375 | dd($th); |
376 | 376 | } |
@@ -380,13 +380,13 @@ discard block |
||
380 | 380 | public function downloadErrors() |
381 | 381 | { |
382 | 382 | |
383 | - $file_path = storage_path() . '/app/examination/errors.csv'; |
|
383 | + $file_path = storage_path().'/app/examination/errors.csv'; |
|
384 | 384 | return Response::download($file_path); |
385 | 385 | } |
386 | 386 | |
387 | 387 | public function downloadProcessedFile() |
388 | 388 | { |
389 | - $file_path = storage_path() . '/app/examination/student_data_with_nsid.csv'; |
|
389 | + $file_path = storage_path().'/app/examination/student_data_with_nsid.csv'; |
|
390 | 390 | return Response::download($file_path); |
391 | 391 | } |
392 | 392 | } |