@@ -48,21 +48,21 @@ |
||
| 48 | 48 | $mode = $this->argument('mode'); |
| 49 | 49 | $academicPeriod = $this->academic_period->getAcademicPeriod($year); |
| 50 | 50 | $previousAcademicPeriodYear = $academicPeriod->order; |
| 51 | - $previousAcademicPeriod = Academic_period::where('order',$previousAcademicPeriodYear+1)->first(); |
|
| 52 | - $institutions = $this->instituion_grade->getInstitutionGradeList($previousAcademicPeriod->code,$limit,$mode); |
|
| 51 | + $previousAcademicPeriod = Academic_period::where('order', $previousAcademicPeriodYear + 1)->first(); |
|
| 52 | + $institutions = $this->instituion_grade->getInstitutionGradeList($previousAcademicPeriod->code, $limit, $mode); |
|
| 53 | 53 | $params = [ |
| 54 | 54 | 'year' => $year, |
| 55 | 55 | 'mode'=> $mode |
| 56 | 56 | ]; |
| 57 | - if(in_array($mode,['AL','1-5','SP','6-11'])){ |
|
| 58 | - array_walk($institutions,array($this,'callPromotion'),$params); |
|
| 59 | - }else{ |
|
| 57 | + if (in_array($mode, ['AL', '1-5', 'SP', '6-11'])) { |
|
| 58 | + array_walk($institutions, array($this, 'callPromotion'), $params); |
|
| 59 | + }else { |
|
| 60 | 60 | die('The give mode not support'); |
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | } |
| 64 | 64 | |
| 65 | - protected function callPromotion($institution,$count,$params){ |
|
| 66 | - $this->call('promote:students',['year' => $params['year'],'institution' => $institution['code'],'mode' => $params['mode'] ]); |
|
| 65 | + protected function callPromotion($institution, $count, $params) { |
|
| 66 | + $this->call('promote:students', ['year' => $params['year'], 'institution' => $institution['code'], 'mode' => $params['mode']]); |
|
| 67 | 67 | } |
| 68 | 68 | } |
@@ -56,7 +56,7 @@ |
||
| 56 | 56 | ]; |
| 57 | 57 | if(in_array($mode,['AL','1-5','SP','6-11'])){ |
| 58 | 58 | array_walk($institutions,array($this,'callPromotion'),$params); |
| 59 | - }else{ |
|
| 59 | + } else{ |
|
| 60 | 60 | die('The give mode not support'); |
| 61 | 61 | } |
| 62 | 62 | |
@@ -65,15 +65,15 @@ |
||
| 65 | 65 | $institution = $this->argument('institution'); |
| 66 | 66 | $academicPeriod = $this->academic_period->getAcademicPeriod($year); |
| 67 | 67 | $previousAcademicPeriodYear = $academicPeriod->order; |
| 68 | - $previousAcademicPeriod = Academic_period::where('order',$previousAcademicPeriodYear+1)->first(); |
|
| 68 | + $previousAcademicPeriod = Academic_period::where('order', $previousAcademicPeriodYear + 1)->first(); |
|
| 69 | 69 | $mode = $this->argument('mode'); |
| 70 | - $institutionGrade = $this->instituion_grade->getInstitutionGradeToPromoted($previousAcademicPeriod->code,$institution,$mode); |
|
| 70 | + $institutionGrade = $this->instituion_grade->getInstitutionGradeToPromoted($previousAcademicPeriod->code, $institution, $mode); |
|
| 71 | 71 | $output->writeln('Start promoting:'.$institution); |
| 72 | 72 | $params = [ |
| 73 | 73 | 'academicPeriod' => $academicPeriod, |
| 74 | 74 | 'previousAcademicPeriod' => $previousAcademicPeriod |
| 75 | 75 | ]; |
| 76 | - (new BulkPromotion())->callback($institutionGrade,$params); |
|
| 76 | + (new BulkPromotion())->callback($institutionGrade, $params); |
|
| 77 | 77 | $output->writeln('Finished promoting:'.$institution); |
| 78 | 78 | } |
| 79 | 79 | } |
@@ -4,7 +4,7 @@ discard block |
||
| 4 | 4 | |
| 5 | 5 | use Illuminate\Database\Eloquent\Model; |
| 6 | 6 | |
| 7 | -class Education_grades_subject extends Model { |
|
| 7 | +class Education_grades_subject extends Model { |
|
| 8 | 8 | |
| 9 | 9 | /** |
| 10 | 10 | * The database table used by the model. |
@@ -42,12 +42,12 @@ discard block |
||
| 42 | 42 | protected $dates = ['modified', 'created']; |
| 43 | 43 | |
| 44 | 44 | |
| 45 | - public function institutionGradeSubject(){ |
|
| 46 | - return $this->hasMany('App\Models\Institution_subject','education_grade_id','education_grade_id'); |
|
| 45 | + public function institutionGradeSubject() { |
|
| 46 | + return $this->hasMany('App\Models\Institution_subject', 'education_grade_id', 'education_grade_id'); |
|
| 47 | 47 | } |
| 48 | 48 | |
| 49 | - public function getGradeSubjects($educationGrade){ |
|
| 50 | - self::where('education_grade_id',$educationGrade['education_grade_id']) |
|
| 49 | + public function getGradeSubjects($educationGrade) { |
|
| 50 | + self::where('education_grade_id', $educationGrade['education_grade_id']) |
|
| 51 | 51 | ->get() |
| 52 | 52 | ->toArray(); |
| 53 | 53 | ; |
@@ -4,7 +4,7 @@ discard block |
||
| 4 | 4 | |
| 5 | 5 | use Illuminate\Database\Eloquent\Model; |
| 6 | 6 | |
| 7 | -class Institution_subject extends Base_Model { |
|
| 7 | +class Institution_subject extends Base_Model { |
|
| 8 | 8 | |
| 9 | 9 | /** |
| 10 | 10 | * The database table used by the model. |
@@ -42,29 +42,29 @@ discard block |
||
| 42 | 42 | protected $dates = ['modified', 'created', 'modified', 'created']; |
| 43 | 43 | |
| 44 | 44 | |
| 45 | - public function institutionGradeSubject(){ |
|
| 46 | - return $this->belongsTo('App\Models\Education_grades_subject','education_subject_id','education_subject_id'); |
|
| 45 | + public function institutionGradeSubject() { |
|
| 46 | + return $this->belongsTo('App\Models\Education_grades_subject', 'education_subject_id', 'education_subject_id'); |
|
| 47 | 47 | } |
| 48 | 48 | |
| 49 | - public function institutionOptionalGradeSubject(){ |
|
| 50 | - return $this->belongsTo('App\Models\Education_grades_subject','education_grade_id','education_grade_id'); |
|
| 49 | + public function institutionOptionalGradeSubject() { |
|
| 50 | + return $this->belongsTo('App\Models\Education_grades_subject', 'education_grade_id', 'education_grade_id'); |
|
| 51 | 51 | } |
| 52 | 52 | |
| 53 | - public function institutionMandatoryGradeSubject(){ |
|
| 54 | - return $this->belongsTo('App\Models\Education_grades_subject','education_grade_id','education_grade_id'); |
|
| 53 | + public function institutionMandatoryGradeSubject() { |
|
| 54 | + return $this->belongsTo('App\Models\Education_grades_subject', 'education_grade_id', 'education_grade_id'); |
|
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | |
| 58 | - public function institutionClassSubject(){ |
|
| 59 | - return $this->hasMany('App\Models\Institution_class_subject','institution_class_id','id'); |
|
| 58 | + public function institutionClassSubject() { |
|
| 59 | + return $this->hasMany('App\Models\Institution_class_subject', 'institution_class_id', 'id'); |
|
| 60 | 60 | } |
| 61 | 61 | |
| 62 | 62 | |
| 63 | 63 | |
| 64 | - public function getInstitutionSubjects($institution_id,$academic_period_id){ |
|
| 65 | - $query = self::query()->where('institution_id',$institution_id) |
|
| 66 | - ->where('academic_period_id',$academic_period_id) |
|
| 67 | - ->join('education_grades_subjects','institution_subjects.education_subject_id','education_grades_subjects.id') |
|
| 64 | + public function getInstitutionSubjects($institution_id, $academic_period_id) { |
|
| 65 | + $query = self::query()->where('institution_id', $institution_id) |
|
| 66 | + ->where('academic_period_id', $academic_period_id) |
|
| 67 | + ->join('education_grades_subjects', 'institution_subjects.education_subject_id', 'education_grades_subjects.id') |
|
| 68 | 68 | ->join('education_grades', 'education_grades_subjects.education_grade_id', 'education_grades.id') |
| 69 | 69 | ->groupBy('education_grades_subjects.id'); |
| 70 | 70 | return $query->get()->toArray(); |
@@ -72,15 +72,15 @@ discard block |
||
| 72 | 72 | |
| 73 | 73 | public static function getStudentsCount($institution_subject_id) |
| 74 | 74 | { |
| 75 | - $total_male_students = self::with(['student' => function ($query) { |
|
| 75 | + $total_male_students = self::with(['student' => function($query) { |
|
| 76 | 76 | $query->where('student.gender_id', '=', 1); |
| 77 | - }])->whereHas('student', function ($query) { |
|
| 77 | + }])->whereHas('student', function($query) { |
|
| 78 | 78 | $query->where('gender_id', '=', 1); |
| 79 | 79 | })->where('institution_subject_id', '=', $institution_subject_id)->count(); |
| 80 | 80 | |
| 81 | - $total_female_students = self::with(['student' => function ($query) { |
|
| 81 | + $total_female_students = self::with(['student' => function($query) { |
|
| 82 | 82 | $query->where('student.gender_id', '=', 2); |
| 83 | - }])->whereHas('student', function ($query) { |
|
| 83 | + }])->whereHas('student', function($query) { |
|
| 84 | 84 | $query->where('gender_id', '=', 2); |
| 85 | 85 | })->where('institution_subject_id', '=', $institution_subject_id)->count(); |
| 86 | 86 | |
@@ -4,7 +4,7 @@ discard block |
||
| 4 | 4 | |
| 5 | 5 | use Illuminate\Database\Eloquent\Model; |
| 6 | 6 | |
| 7 | -class Education_grade extends Model { |
|
| 7 | +class Education_grade extends Model { |
|
| 8 | 8 | |
| 9 | 9 | /** |
| 10 | 10 | * The database table used by the model. |
@@ -41,17 +41,17 @@ discard block |
||
| 41 | 41 | */ |
| 42 | 42 | protected $dates = ['modified', 'created']; |
| 43 | 43 | |
| 44 | - public function getNextGrade($gradeId,$getNextProgrammeGrades = false, $firstGradeOnly = false){ |
|
| 44 | + public function getNextGrade($gradeId, $getNextProgrammeGrades = false, $firstGradeOnly = false) { |
|
| 45 | 45 | if (!empty($gradeId)) { |
| 46 | 46 | $gradeObj = $this->find($gradeId); |
| 47 | 47 | $programmeId = $gradeObj->education_programme_id; |
| 48 | 48 | $order = $gradeObj->order; |
| 49 | - $gradeOptions = self::where( 'education_programme_id',$programmeId |
|
| 50 | - )->where('order',$order+1)->get()->first(); |
|
| 49 | + $gradeOptions = self::where('education_programme_id', $programmeId |
|
| 50 | + )->where('order', $order + 1)->get()->first(); |
|
| 51 | 51 | $nextProgramme = self::getNextProgrammeList($programmeId); |
| 52 | - if(is_null($gradeOptions) && !is_null($nextProgramme)){ |
|
| 53 | - $programmeId = $nextProgramme->next_programme_id; |
|
| 54 | - $gradeOptions = self::where( 'education_programme_id',$programmeId |
|
| 52 | + if (is_null($gradeOptions) && !is_null($nextProgramme)) { |
|
| 53 | + $programmeId = $nextProgramme->next_programme_id; |
|
| 54 | + $gradeOptions = self::where('education_programme_id', $programmeId |
|
| 55 | 55 | ) |
| 56 | 56 | ->orderBy('order') |
| 57 | 57 | ->get()->first(); |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | // $results = $gradeOptions; |
| 69 | 69 | // } |
| 70 | 70 | return $gradeOptions; |
| 71 | - } else { |
|
| 71 | + }else { |
|
| 72 | 72 | return null; |
| 73 | 73 | } |
| 74 | 74 | } |
@@ -80,15 +80,15 @@ discard block |
||
| 80 | 80 | |
| 81 | 81 | foreach ($nextProgrammeList as $nextProgrammeId) { |
| 82 | 82 | $nextProgrammeGradeResults = self:: |
| 83 | - where('education_programme_id',$nextProgrammeId->next_programme_id)->get()->toArray(); |
|
| 83 | + where('education_programme_id', $nextProgrammeId->next_programme_id)->get()->toArray(); |
|
| 84 | 84 | |
| 85 | 85 | $results = $results + [key($nextProgrammeGradeResults) => current($nextProgrammeGradeResults)]; |
| 86 | 86 | } |
| 87 | - } else { |
|
| 87 | + }else { |
|
| 88 | 88 | $results = []; |
| 89 | 89 | } |
| 90 | 90 | |
| 91 | - return (object)$results; |
|
| 91 | + return (object) $results; |
|
| 92 | 92 | } |
| 93 | 93 | |
| 94 | 94 | |
@@ -102,9 +102,9 @@ discard block |
||
| 102 | 102 | |
| 103 | 103 | $nextProgrammeList = $this->getNextProgrammeList($id); |
| 104 | 104 | if (!empty($nextProgrammeList)) { |
| 105 | - $results = self::whereIn('education_programme_id',$nextProgrammeList) |
|
| 105 | + $results = self::whereIn('education_programme_id', $nextProgrammeList) |
|
| 106 | 106 | ->get()->toArray(); |
| 107 | - } else { |
|
| 107 | + }else { |
|
| 108 | 108 | $results = []; |
| 109 | 109 | } |
| 110 | 110 | |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | * @return array List of next education programmes id |
| 119 | 119 | */ |
| 120 | 120 | public function getNextProgrammeList($id) { |
| 121 | - return Education_programmes_next_programme::where('education_programme_id',$id) |
|
| 121 | + return Education_programmes_next_programme::where('education_programme_id', $id) |
|
| 122 | 122 | ->get()->first(); |
| 123 | 123 | } |
| 124 | 124 | |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | |
| 75 | 75 | public function process($student) |
| 76 | 76 | { |
| 77 | - try{ |
|
| 77 | + try{ |
|
| 78 | 78 | $wrongStudentsClass = Institution_class_student::where('institution_id', $student['institution_id']) |
| 79 | 79 | ->whereRaw('institution_class_id not in (select id from institution_classes where institution_id ='.$student['institution_id'].' )') |
| 80 | 80 | ->orWhere('institution_class_id', 0) |
@@ -143,8 +143,8 @@ discard block |
||
| 143 | 143 | $this->output->writeln("student record :".$student['student_id'] ); |
| 144 | 144 | } |
| 145 | 145 | } |
| 146 | - }catch(\Exception $e){ |
|
| 146 | + }catch(\Exception $e){ |
|
| 147 | 147 | dd($e); |
| 148 | - } |
|
| 148 | + } |
|
| 149 | 149 | } |
| 150 | 150 | } |
@@ -51,10 +51,10 @@ discard block |
||
| 51 | 51 | |
| 52 | 52 | if ($this->argument('code') !== 'All') { |
| 53 | 53 | $institutions = Institution::where('code', $this->argument('code'))->get()->toArray(); |
| 54 | - processParallel(array($this,'processInstitution'),$institutions,$this->argument('max')); |
|
| 55 | - } else { |
|
| 54 | + processParallel(array($this, 'processInstitution'), $institutions, $this->argument('max')); |
|
| 55 | + }else { |
|
| 56 | 56 | $institutions = Institution::where('institution_status_id', 1)->get()->toArray(); |
| 57 | - processParallel(array($this,'processInstitution'),$institutions,$this->argument('max')); |
|
| 57 | + processParallel(array($this, 'processInstitution'), $institutions, $this->argument('max')); |
|
| 58 | 58 | } |
| 59 | 59 | } |
| 60 | 60 | |
@@ -65,16 +65,16 @@ discard block |
||
| 65 | 65 | ->where('institutions.id', $institution['id']) |
| 66 | 66 | ->get()->toArray(); |
| 67 | 67 | if (count($students) > 0) { |
| 68 | - array_walk($students,array($this, 'process')); |
|
| 69 | - $this->output->writeln("institution :" .$institution['code']. ' cleaned'); |
|
| 70 | - } else { |
|
| 71 | - $this->output->writeln("all records are cleaned at :".$institution['code'] ); |
|
| 68 | + array_walk($students, array($this, 'process')); |
|
| 69 | + $this->output->writeln("institution :".$institution['code'].' cleaned'); |
|
| 70 | + }else { |
|
| 71 | + $this->output->writeln("all records are cleaned at :".$institution['code']); |
|
| 72 | 72 | } |
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | public function process($student) |
| 76 | 76 | { |
| 77 | - try{ |
|
| 77 | + try { |
|
| 78 | 78 | $wrongStudentsClass = Institution_class_student::where('institution_id', $student['institution_id']) |
| 79 | 79 | ->whereRaw('institution_class_id not in (select id from institution_classes where institution_id ='.$student['institution_id'].' )') |
| 80 | 80 | ->orWhere('institution_class_id', 0) |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | |
| 89 | 89 | array_walk($wrongStudentsClass, array($this->class, 'updateClassCount')); |
| 90 | 90 | |
| 91 | - $institutionClass = Institution_class::getGradeClasses($student['education_grade_id'], $student['institution_id']); |
|
| 91 | + $institutionClass = Institution_class::getGradeClasses($student['education_grade_id'], $student['institution_id']); |
|
| 92 | 92 | |
| 93 | 93 | if (count($institutionClass) == 1) { |
| 94 | 94 | $start_date = new Carbon($student['start_date']); |
@@ -140,10 +140,10 @@ discard block |
||
| 140 | 140 | ]); |
| 141 | 141 | $institutionClassStudent = [$institutionClassStudent]; |
| 142 | 142 | array_walk($institutionClassStudent, array($this->class, 'updateClassCount')); |
| 143 | - $this->output->writeln("student record :".$student['student_id'] ); |
|
| 143 | + $this->output->writeln("student record :".$student['student_id']); |
|
| 144 | 144 | } |
| 145 | 145 | } |
| 146 | - }catch(\Exception $e){ |
|
| 146 | + }catch (\Exception $e) { |
|
| 147 | 147 | dd($e); |
| 148 | 148 | } |
| 149 | 149 | } |
@@ -143,7 +143,7 @@ |
||
| 143 | 143 | $this->output->writeln("student record :".$student['student_id'] ); |
| 144 | 144 | } |
| 145 | 145 | } |
| 146 | - }catch(\Exception $e){ |
|
| 146 | + } catch(\Exception $e){ |
|
| 147 | 147 | dd($e); |
| 148 | 148 | } |
| 149 | 149 | } |
@@ -68,12 +68,12 @@ |
||
| 68 | 68 | ->where('academic_periods.code', $year); |
| 69 | 69 | |
| 70 | 70 | if ($mode) { |
| 71 | - $query->whereIn('institution_shifts.cloned',['2020']); |
|
| 72 | - } else { |
|
| 73 | - $query->whereNotIn('institution_shifts.cloned',['2020','2019/2020']); |
|
| 71 | + $query->whereIn('institution_shifts.cloned', ['2020']); |
|
| 72 | + }else { |
|
| 73 | + $query->whereNotIn('institution_shifts.cloned', ['2020', '2019/2020']); |
|
| 74 | 74 | } |
| 75 | 75 | |
| 76 | - $data = $query->groupBy('institution_shifts.id') |
|
| 76 | + $data = $query->groupBy('institution_shifts.id') |
|
| 77 | 77 | ->limit($limit) |
| 78 | 78 | ->get() |
| 79 | 79 | ->toArray(); |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | } |
| 61 | 61 | |
| 62 | 62 | |
| 63 | - public function getShiftClasses($shift, $al , $param = []) |
|
| 63 | + public function getShiftClasses($shift, $al, $param = []) |
|
| 64 | 64 | { |
| 65 | 65 | $query = self::query() |
| 66 | 66 | ->select( |
@@ -75,20 +75,20 @@ discard block |
||
| 75 | 75 | |
| 76 | 76 | ) |
| 77 | 77 | ->join('institution_class_grades', 'institution_classes.id', 'institution_class_grades.institution_class_id') |
| 78 | - ->join('education_grades','institution_class_grades.education_grade_id','education_grades.id') |
|
| 78 | + ->join('education_grades', 'institution_class_grades.education_grade_id', 'education_grades.id') |
|
| 79 | 79 | ->join('education_programmes', 'education_grades.education_programme_id', 'education_programmes.id') |
| 80 | - ->join('education_cycles', 'education_programmes.education_cycle_id','education_cycles.id') |
|
| 80 | + ->join('education_cycles', 'education_programmes.education_cycle_id', 'education_cycles.id') |
|
| 81 | 81 | ->groupBy('institution_classes.id'); |
| 82 | 82 | |
| 83 | 83 | if ($al == true) { |
| 84 | 84 | $query->where('education_programmes.education_cycle_id', 4) |
| 85 | 85 | ->where('institution_shift_id', $shift['id']) |
| 86 | - ->where('institution_classes.academic_period_id',$param['previous_academic_period_id']); |
|
| 86 | + ->where('institution_classes.academic_period_id', $param['previous_academic_period_id']); |
|
| 87 | 87 | $data = $query |
| 88 | 88 | ->groupBy('institution_classes.id') |
| 89 | 89 | ->get()->toArray(); |
| 90 | 90 | return $data; |
| 91 | - } else { |
|
| 91 | + }else { |
|
| 92 | 92 | $query |
| 93 | 93 | // ->where('education_programmes.education_cycle_id','<>',4) |
| 94 | 94 | ->where('institution_shift_id', $shift['id']); |
@@ -99,13 +99,13 @@ discard block |
||
| 99 | 99 | } |
| 100 | 100 | } |
| 101 | 101 | |
| 102 | - public static function getGradeClasses($education_grade_id,$institution_id){ |
|
| 102 | + public static function getGradeClasses($education_grade_id, $institution_id) { |
|
| 103 | 103 | return self::query() |
| 104 | - ->select('institution_classes.id','institution_classes.institution_id','institution_classes.institution_shift_id', |
|
| 105 | - 'institution_classes.name','institution_classes.no_of_students','institution_classes.class_number','institution_class_grades.education_grade_id') |
|
| 106 | - ->where('institution_class_grades.education_grade_id',$education_grade_id) |
|
| 107 | - ->where('institution_classes.institution_id',$institution_id) |
|
| 108 | - ->join('institution_class_grades','institution_classes.id','institution_class_grades.institution_class_id') |
|
| 104 | + ->select('institution_classes.id', 'institution_classes.institution_id', 'institution_classes.institution_shift_id', |
|
| 105 | + 'institution_classes.name', 'institution_classes.no_of_students', 'institution_classes.class_number', 'institution_class_grades.education_grade_id') |
|
| 106 | + ->where('institution_class_grades.education_grade_id', $education_grade_id) |
|
| 107 | + ->where('institution_classes.institution_id', $institution_id) |
|
| 108 | + ->join('institution_class_grades', 'institution_classes.id', 'institution_class_grades.institution_class_id') |
|
| 109 | 109 | ->get()->toArray(); |
| 110 | 110 | } |
| 111 | 111 | |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | if (!empty($isAvailableforPromotion)) { |
| 65 | 65 | $this->process($institutionGrade, $nextGrade, $params); |
| 66 | 66 | DB::commit(); |
| 67 | - } else { |
|
| 67 | + }else { |
|
| 68 | 68 | DB::rollBack(); |
| 69 | 69 | } |
| 70 | 70 | //leave school levers |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | // $this->process($institutionGrade, $nextGrade, $params); |
| 73 | 73 | // } |
| 74 | 74 | } |
| 75 | - } catch (\Exception $e) { |
|
| 75 | + }catch (\Exception $e) { |
|
| 76 | 76 | DB::rollBack(); |
| 77 | 77 | } |
| 78 | 78 | } |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | |
| 106 | 106 | $output = new \Symfony\Component\Console\Output\ConsoleOutput(); |
| 107 | 107 | $output->writeln('##########################################################################################################################'); |
| 108 | - $output->writeln('Promoting from ' . $institutionGrade['name'] . ' IN ' . $institution->name . ' No of Students: ' . count($studentListToPromote)); |
|
| 108 | + $output->writeln('Promoting from '.$institutionGrade['name'].' IN '.$institution->name.' No of Students: '.count($studentListToPromote)); |
|
| 109 | 109 | |
| 110 | 110 | |
| 111 | 111 | if (!empty($parallelClasses)) { |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | array_walk($parallelClasses, array($this, 'updateStudentCount')); |
| 121 | 121 | DB::commit(); |
| 122 | 122 | } |
| 123 | - } catch (\Exception $e) { |
|
| 123 | + }catch (\Exception $e) { |
|
| 124 | 124 | DB::rollBack(); |
| 125 | 125 | Log::error($e->getMessage()); |
| 126 | 126 | } |
@@ -155,7 +155,7 @@ discard block |
||
| 155 | 155 | $previousAcademicPeriod = $params['previousAcademicPeriod']; |
| 156 | 156 | $nextGradeObj = null; |
| 157 | 157 | $currentGradeObj = $this->instituion_grade->getParallelClasses($institutionGrade['id'], $institutionGrade['institution_id'], $institutionGrade['education_grade_id'], $previousAcademicPeriod->id); |
| 158 | - if ($nextGrade !== [] && !is_null($nextGrade)) { |
|
| 158 | + if ($nextGrade !== [] && !is_null($nextGrade)) { |
|
| 159 | 159 | $nextGradeObj = $this->instituion_grade->getParallelClasses($institutionGrade['id'], $institutionGrade['institution_id'], $nextGrade->id, $academicPeriod->id); |
| 160 | 160 | } |
| 161 | 161 | |
@@ -164,7 +164,7 @@ discard block |
||
| 164 | 164 | // promote parallel classes |
| 165 | 165 | $this->promotion($institutionGrade, $nextGrade, $previousAcademicPeriod, $academicPeriod, $nextGradeObj->toArray(), 1); |
| 166 | 166 | return 1; |
| 167 | - } elseif (($nextGradeObj->count() > 1) && ($nextGradeObj->count() !== $currentGradeObj->count())) { |
|
| 167 | + } elseif (($nextGradeObj->count() > 1) && ($nextGradeObj->count() !== $currentGradeObj->count())) { |
|
| 168 | 168 | // promote pool promotion |
| 169 | 169 | $this->promotion($institutionGrade, $nextGrade, $previousAcademicPeriod, $academicPeriod, [], 1); |
| 170 | 170 | return 2; |
@@ -172,12 +172,12 @@ discard block |
||
| 172 | 172 | // Promote matching class name with previous class |
| 173 | 173 | $this->promotion($institutionGrade, $nextGrade, $previousAcademicPeriod, $academicPeriod, $nextGradeObj->toArray(), 1); |
| 174 | 174 | return 1; |
| 175 | - } else { |
|
| 175 | + }else { |
|
| 176 | 176 | // default pool promotion |
| 177 | 177 | $this->promotion($institutionGrade, $nextGrade, $previousAcademicPeriod, $academicPeriod, [], 1); |
| 178 | 178 | return 2; |
| 179 | 179 | } |
| 180 | - } else { |
|
| 180 | + }else { |
|
| 181 | 181 | // default pool promotion |
| 182 | 182 | $this->promotion($institutionGrade, $nextGrade, $previousAcademicPeriod, $academicPeriod, [], 3); |
| 183 | 183 | return 2; |
@@ -213,10 +213,10 @@ discard block |
||
| 213 | 213 | ]; |
| 214 | 214 | |
| 215 | 215 | try { |
| 216 | - Institution_student::where('id', (string)$student['id'])->update($studentData); |
|
| 216 | + Institution_student::where('id', (string) $student['id'])->update($studentData); |
|
| 217 | 217 | $output = new \Symfony\Component\Console\Output\ConsoleOutput(); |
| 218 | - $output->writeln('----------------- ' . $student['admission_id'] . ' to ' . $studentData['education_grade_id']); |
|
| 219 | - } catch (\Exception $e) { |
|
| 218 | + $output->writeln('----------------- '.$student['admission_id'].' to '.$studentData['education_grade_id']); |
|
| 219 | + }catch (\Exception $e) { |
|
| 220 | 220 | Log::error($e->getMessage()); |
| 221 | 221 | } |
| 222 | 222 | } |
@@ -236,13 +236,13 @@ discard block |
||
| 236 | 236 | $studentClass = $this->institution_class_students->getStudentNewClass($student); |
| 237 | 237 | if (!is_null($studentClass)) { |
| 238 | 238 | $class = array_search(str_replace($educationGrade['name'], $nextGrade->name, $studentClass->name), array_column($classes, 'name')); |
| 239 | - if(!($class)){ |
|
| 240 | - $nextGradeName = explode(" ",$nextGrade->name)[0]; |
|
| 241 | - $educationGrade['name'] = explode(" ",$educationGrade['name'])[0]; |
|
| 239 | + if (!($class)) { |
|
| 240 | + $nextGradeName = explode(" ", $nextGrade->name)[0]; |
|
| 241 | + $educationGrade['name'] = explode(" ", $educationGrade['name'])[0]; |
|
| 242 | 242 | $class = array_search(str_replace($educationGrade['name'], $nextGradeName, $studentClass->name), array_column($classes, 'name')); |
| 243 | 243 | } |
| 244 | 244 | return $class; |
| 245 | - } else { |
|
| 245 | + }else { |
|
| 246 | 246 | return false; |
| 247 | 247 | } |
| 248 | 248 | } |
@@ -264,7 +264,7 @@ discard block |
||
| 264 | 264 | $class = null; |
| 265 | 265 | if (count($classes) == 1) { |
| 266 | 266 | $class = $classes[0]; |
| 267 | - } else { |
|
| 267 | + }else { |
|
| 268 | 268 | $class = $this->getStudentClass($student, $educationGrade, $nextGrade, $classes); |
| 269 | 269 | if (is_numeric($class)) { |
| 270 | 270 | $class = $classes[$class]; |
@@ -296,13 +296,13 @@ discard block |
||
| 296 | 296 | // array_walk($allInsSubjects,array($this,'updateSubjectCount')); |
| 297 | 297 | // } |
| 298 | 298 | $output = new \Symfony\Component\Console\Output\ConsoleOutput(); |
| 299 | - $output->writeln('----------------- ' . $student['student_id'] . 'to ' . $class['name']); |
|
| 300 | - } else { |
|
| 301 | - $this->institution_class_students->where('id', (string)$student['id'])->update($studentObj); |
|
| 299 | + $output->writeln('----------------- '.$student['student_id'].'to '.$class['name']); |
|
| 300 | + }else { |
|
| 301 | + $this->institution_class_students->where('id', (string) $student['id'])->update($studentObj); |
|
| 302 | 302 | $output = new \Symfony\Component\Console\Output\ConsoleOutput(); |
| 303 | - $output->writeln('----------------- ' . $student['student_id'] . 'to ' . $class['name']); |
|
| 303 | + $output->writeln('----------------- '.$student['student_id'].'to '.$class['name']); |
|
| 304 | 304 | } |
| 305 | - } catch (\Exception $e) { |
|
| 305 | + }catch (\Exception $e) { |
|
| 306 | 306 | |
| 307 | 307 | Log::error($e->getMessage()); |
| 308 | 308 | } |