@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | $func = array($this,'updateCount'); |
| 54 | 54 | array_walk($subjects,array($this,'process')); |
| 55 | 55 | $this->output->writeln('start updating:'. count($classes)); |
| 56 | - }elseif($this->argument('entity') == 'subject'){ |
|
| 56 | + } elseif($this->argument('entity') == 'subject'){ |
|
| 57 | 57 | $subjects = Institution_subject::get()->toArray(); |
| 58 | 58 | $subjects = array_chunk($subjects,10000); |
| 59 | 59 | $this->output->writeln('start updating:'. count($subjects)); |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | $func = array($this,'updateCount'); |
| 69 | 69 | processParallel($func,$data,$this->argument('max')); |
| 70 | 70 | $this->output->writeln('start updating calss count:'. count($data)); |
| 71 | - }elseif($this->argument('entity') == 'subject'){ |
|
| 71 | + } elseif($this->argument('entity') == 'subject'){ |
|
| 72 | 72 | $this->output->writeln('start updating subject count:'. count($data)); |
| 73 | 73 | $func_subject = array($this,'updateSubjectCount'); |
| 74 | 74 | processParallel($func_subject,$data,$this->argument('max')); |
@@ -138,7 +138,7 @@ |
||
| 138 | 138 | ->join('contact_types', 'user_contacts.contact_type_id', '=', 'contact_types.id') |
| 139 | 139 | //only for UAT |
| 140 | 140 | // ->where('contact_types.contact_option_id', '=', 5) |
| 141 | - ->where('contact_types.contact_option_id', '!=', 5) |
|
| 141 | + ->where('contact_types.contact_option_id', '!=', 5) |
|
| 142 | 142 | // ->where('contact_types.name', '=', 'TestEmail') |
| 143 | 143 | ->limit(1) |
| 144 | 144 | ->get()->toArray(); |
@@ -85,11 +85,11 @@ |
||
| 85 | 85 | |
| 86 | 86 | public function process($students){ |
| 87 | 87 | $type = $this->argument('type'); |
| 88 | - if($type == 'duplication'){ |
|
| 88 | + if($type == 'duplication'){ |
|
| 89 | 89 | array_walk($students,array($this,'cleanData')); |
| 90 | - }elseif($type == 'invalid' || 'all'){ |
|
| 90 | + }elseif($type == 'invalid' || 'all'){ |
|
| 91 | 91 | array_walk($students,array($this,'cleanInvalidData')); |
| 92 | - } |
|
| 92 | + } |
|
| 93 | 93 | } |
| 94 | 94 | |
| 95 | 95 | |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | ->whereRaw('CHAR_LENGTH(nsid) > 11') |
| 54 | 54 | ->get() |
| 55 | 55 | ->toArray(); |
| 56 | - }elseif($type == 'duplicate'){ |
|
| 56 | + } elseif($type == 'duplicate'){ |
|
| 57 | 57 | $students = DB::table('institution_students as is') |
| 58 | 58 | ->join('security_users as su', 'su.id', 'is.student_id') |
| 59 | 59 | ->where('is.updated_from', 'doe') |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | ->get() |
| 64 | 64 | ->toArray(); |
| 65 | 65 | |
| 66 | - }elseif('all'){ |
|
| 66 | + } elseif('all'){ |
|
| 67 | 67 | $students = DB::table('examination_students') |
| 68 | 68 | ->where('nsid','<>','') |
| 69 | 69 | ->whereNotNull('nsid') |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | $students = array_chunk($students, $this->argument('chunk')); |
| 78 | 78 | $function = array($this, 'process'); |
| 79 | 79 | processParallel($function,$students, $this->argument('max')); |
| 80 | - }else{ |
|
| 80 | + } else{ |
|
| 81 | 81 | $this->output->writeln('nothing to process, all are cleaned'); |
| 82 | 82 | } |
| 83 | 83 | $this->output->writeln('###########################################------Finished cleaning exam records------###########################################'); |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | $type = $this->argument('type'); |
| 88 | 88 | if($type == 'duplication'){ |
| 89 | 89 | array_walk($students,array($this,'cleanData')); |
| 90 | - }elseif($type == 'invalid' || 'all'){ |
|
| 90 | + } elseif($type == 'invalid' || 'all'){ |
|
| 91 | 91 | array_walk($students,array($this,'cleanInvalidData')); |
| 92 | 92 | } |
| 93 | 93 | } |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | |
| 55 | 55 | public function updateOrInsertRecord($user) |
| 56 | 56 | { |
| 57 | - try { |
|
| 57 | + try { |
|
| 58 | 58 | // regenerate unique id if it's not available |
| 59 | 59 | $uniqueId = $this->uniqueUserId::isValidUniqueId($user['openemis_no'],9) ? $this->uniqueUserId::getUniqueAlphanumeric() : $user['openemis_no']; |
| 60 | 60 | |
@@ -69,9 +69,9 @@ discard block |
||
| 69 | 69 | ]); |
| 70 | 70 | } |
| 71 | 71 | return $user; |
| 72 | - } catch (\Exception $th) { |
|
| 73 | - $user['openemis_no'] = $this->uniqueUserId::getUniqueAlphanumeric(); |
|
| 74 | - $this->updateOrInsertRecord($user); |
|
| 75 | - } |
|
| 72 | + } catch (\Exception $th) { |
|
| 73 | + $user['openemis_no'] = $this->uniqueUserId::getUniqueAlphanumeric(); |
|
| 74 | + $this->updateOrInsertRecord($user); |
|
| 75 | + } |
|
| 76 | 76 | } |
| 77 | 77 | } |
@@ -70,21 +70,21 @@ |
||
| 70 | 70 | */ |
| 71 | 71 | public static function isDuplicated($inputs){ |
| 72 | 72 | |
| 73 | - $exists = self::where('student_id','=',$inputs['student_id']) |
|
| 74 | - ->where('institution_subject_id','=',$inputs['institution_subject_id']) |
|
| 75 | - ->where('education_subject_id','=',$inputs['education_subject_id'])->count(); |
|
| 73 | + $exists = self::where('student_id','=',$inputs['student_id']) |
|
| 74 | + ->where('institution_subject_id','=',$inputs['institution_subject_id']) |
|
| 75 | + ->where('education_subject_id','=',$inputs['education_subject_id'])->count(); |
|
| 76 | 76 | |
| 77 | 77 | |
| 78 | 78 | return $exists ? true :false; |
| 79 | 79 | } |
| 80 | 80 | |
| 81 | 81 | |
| 82 | - public function student(){ |
|
| 82 | + public function student(){ |
|
| 83 | 83 | return $this->belongsTo('App\Models\Security_user','student_id'); |
| 84 | 84 | } |
| 85 | 85 | |
| 86 | 86 | public static function getStudentsCount($institution_subject_id){ |
| 87 | - $total_male_students = self::with(['student' => function($query) { |
|
| 87 | + $total_male_students = self::with(['student' => function($query) { |
|
| 88 | 88 | $query->where('student.gender_id', '=', 1); |
| 89 | 89 | }])->whereHas('student', function ($query) { |
| 90 | 90 | $query->where('gender_id', '=', 1); |