| @@ -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 | } | 
| @@ -70,10 +70,10 @@ discard block | ||
| 70 | 70 | public function getParallelClasses($id, $institutionId, $educationGradeId, $academicPeriodId) | 
| 71 | 71 |      { | 
| 72 | 72 |          $data = self::find($id)->select('institution_grades.id as insGrade', 'institution_classes.id', 'institution_classes.name', 'institution_grades.education_grade_id') | 
| 73 | -            ->join('institution_classes', function ($join) use ($educationGradeId, $academicPeriodId) { | |
| 73 | +            ->join('institution_classes', function($join) use ($educationGradeId, $academicPeriodId) { | |
| 74 | 74 |                  $join->on('institution_classes.institution_id', '=', 'institution_grades.institution_id') | 
| 75 | 75 |                      ->where('institution_classes.academic_period_id', $academicPeriodId) | 
| 76 | -                    ->join('institution_class_grades', function ($join) use ($educationGradeId) { | |
| 76 | +                    ->join('institution_class_grades', function($join) use ($educationGradeId) { | |
| 77 | 77 |                          $join->on('institution_class_grades.institution_class_id', '=', 'institution_classes.id') | 
| 78 | 78 |                              ->where('institution_class_grades.education_grade_id', $educationGradeId); | 
| 79 | 79 | }) | 
| @@ -123,7 +123,7 @@ discard block | ||
| 123 | 123 |              ->select('education_grades.name', 'institutions.code', 'institutions.name as institution_name', 'institution_grades.id', 'institution_grades.institution_id', 'institution_grades.education_grade_id') | 
| 124 | 124 |              ->where('promoted', '=', $year) | 
| 125 | 125 |              ->join('education_grades', 'institution_grades.education_grade_id', '=', 'education_grades.id') | 
| 126 | -            ->join('institutions', function ($join) use ($year, $institution) { | |
| 126 | +            ->join('institutions', function($join) use ($year, $institution) { | |
| 127 | 127 |                  $join->on('institutions.id', '=', 'institution_grades.institution_id') | 
| 128 | 128 |                      ->where('institutions.code', '=', $institution); | 
| 129 | 129 | }) | 
| @@ -134,7 +134,7 @@ discard block | ||
| 134 | 134 | break; | 
| 135 | 135 | case '6-11': | 
| 136 | 136 |                  $query->whereIn('education_programmes.education_cycle_id', [2, 3]); | 
| 137 | -                $query->whereNotIn('education_grades.id',[29,34]); | |
| 137 | +                $query->whereNotIn('education_grades.id', [29, 34]); | |
| 138 | 138 | break; | 
| 139 | 139 | case 'AL': | 
| 140 | 140 |                  $query->where('education_programmes.education_cycle_id', 4); | 
| @@ -152,21 +152,21 @@ discard block | ||
| 152 | 152 | * @param $year | 
| 153 | 153 | * @return mixed | 
| 154 | 154 | */ | 
| 155 | - public function getInstitutionGradeList($year, $limit,$mode) | |
| 155 | + public function getInstitutionGradeList($year, $limit, $mode) | |
| 156 | 156 |      { | 
| 157 | 157 |          $query = $this->select('education_grades.name', 'institutions.code', 'institutions.name as institution_name', 'institution_grades.id', 'institution_grades.institution_id', 'institution_grades.education_grade_id') | 
| 158 | 158 |              ->where('promoted', '=', $year) | 
| 159 | 159 |              ->join('education_grades', 'institution_grades.education_grade_id', '=', 'education_grades.id') | 
| 160 | -            ->join('institutions', function ($join) use ($year) { | |
| 160 | +            ->join('institutions', function($join) use ($year) { | |
| 161 | 161 |                  $join->on('institutions.id', '=', 'institution_grades.institution_id'); | 
| 162 | 162 | }) | 
| 163 | 163 |              ->join('education_programmes', 'education_grades.education_programme_id', 'education_programmes.id'); | 
| 164 | 164 |              switch ($mode) { | 
| 165 | 165 | case '1-5': | 
| 166 | -                    $query->whereIn('education_programmes.education_cycle_id', [1,2]); | |
| 166 | +                    $query->whereIn('education_programmes.education_cycle_id', [1, 2]); | |
| 167 | 167 | break; | 
| 168 | 168 | case '6-11': | 
| 169 | -                    $query->whereIn('education_programmes.education_cycle_id', [2,3,4]); | |
| 169 | +                    $query->whereIn('education_programmes.education_cycle_id', [2, 3, 4]); | |
| 170 | 170 | break; | 
| 171 | 171 | case 'AL': | 
| 172 | 172 |                      $query->where('education_programmes.education_cycle_id', 4); | 
| @@ -181,13 +181,13 @@ discard block | ||
| 181 | 181 | return $data; | 
| 182 | 182 | } | 
| 183 | 183 | |
| 184 | -    public function getGradeSubjects($institutionId){ | |
| 184 | +    public function getGradeSubjects($institutionId) { | |
| 185 | 185 | return self::query() | 
| 186 | -        ->select('institution_grades.institution_id','education_grades_subjects.education_grade_id','education_grades_subjects.education_subject_id','education_subjects.name') | |
| 187 | -        ->where('institution_grades.institution_id',$institutionId) | |
| 186 | +        ->select('institution_grades.institution_id', 'education_grades_subjects.education_grade_id', 'education_grades_subjects.education_subject_id', 'education_subjects.name') | |
| 187 | +        ->where('institution_grades.institution_id', $institutionId) | |
| 188 | 188 |          ->join('education_grades', 'institution_grades.education_grade_id', 'education_grades.id') | 
| 189 | -        ->join('education_grades_subjects','education_grades.id','education_grades_subjects.education_grade_id') | |
| 190 | -        ->join('education_subjects','education_grades_subjects.education_subject_id','education_subjects.id') | |
| 189 | +        ->join('education_grades_subjects', 'education_grades.id', 'education_grades_subjects.education_grade_id') | |
| 190 | +        ->join('education_subjects', 'education_grades_subjects.education_subject_id', 'education_subjects.id') | |
| 191 | 191 |          ->groupBy('education_grades_subjects.id') | 
| 192 | 192 | ->get() | 
| 193 | 193 | ->toArray(); |