Test Setup Failed
Pull Request — master (#654)
by Mohamed
07:54
created
app/Console/Commands/RemoveDuplicatedGuardians.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -45,14 +45,14 @@  discard block
 block discarded – undo
45 45
             $this->output->writeln('############### Starting delete Duplication ################');
46 46
             Student_guardian::withTrashed()->restore();
47 47
             $this->delete();
48
-            $this->end_time  = microtime(TRUE);
49
-            $this->output->writeln('The cook took ' . ($this->end_time - $this->start_time) . ' seconds to complete');
50
-        } catch (\Throwable $th) {
48
+            $this->end_time = microtime(TRUE);
49
+            $this->output->writeln('The cook took '.($this->end_time - $this->start_time).' seconds to complete');
50
+        }catch (\Throwable $th) {
51 51
         }
52 52
     }
53 53
 
54
-    public function delete(){
55
-       try{
54
+    public function delete() {
55
+       try {
56 56
            DB::statement("UPDATE  student_guardians t1
57 57
            INNER JOIN student_guardians t2 
58 58
                set t1.deleted_at=now() 
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
                t1.id > t2.id AND
61 61
                t1.student_id = t2.student_id AND
62 62
                t1.guardian_id = t2.guardian_id");
63
-       }catch(\Exception $e){
63
+       }catch (\Exception $e) {
64 64
            dd($e);
65 65
        }
66 66
     }
Please login to merge, or discard this patch.
app/Console/Commands/MapStudentArea.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
      */
31 31
     public function __construct()
32 32
     {
33
-        $this->output =  new \Symfony\Component\Console\Output\ConsoleOutput();
33
+        $this->output = new \Symfony\Component\Console\Output\ConsoleOutput();
34 34
         parent::__construct();
35 35
     }
36 36
 
@@ -41,13 +41,13 @@  discard block
 block discarded – undo
41 41
      */
42 42
     public function handle()
43 43
     {
44
-        $students = Security_user::where('is_student',true)->get()->toArray();
45
-        array_walk($students,array($this,'process'));
44
+        $students = Security_user::where('is_student', true)->get()->toArray();
45
+        array_walk($students, array($this, 'process'));
46 46
     }
47 47
 
48
-    public function process($student){
48
+    public function process($student) {
49 49
         $student['student_id'] = $student['id'];
50 50
         Institution_student::updateStudentArea($student);
51
-        $this->output->writeln('area updated for student:'. $student['openemis_no']) ;
51
+        $this->output->writeln('area updated for student:'.$student['openemis_no']);
52 52
     }
53 53
 }
Please login to merge, or discard this patch.
app/Console/Commands/cleanConfig.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -48,16 +48,16 @@
 block discarded – undo
48 48
         $year = $this->argument('year');
49 49
         $academicPeriod = $this->academic_period->getAcademicPeriod($year);
50 50
         $previousAcademicPeriodYear = $academicPeriod->order;
51
-        $previousAcademicPeriod = Academic_period::where('order',$previousAcademicPeriodYear+1)->first();
51
+        $previousAcademicPeriod = Academic_period::where('order', $previousAcademicPeriodYear + 1)->first();
52 52
 
53 53
         $params = [
54 54
             'academic_period' => $academicPeriod,
55 55
             'previous_academic_period' => $previousAcademicPeriod
56 56
         ];
57 57
 
58
-        if($year == '2019' || $year == '2018/19'){
58
+        if ($year == '2019' || $year == '2018/19') {
59 59
             die('Academic Year 2019 or earlier can`t be deleted');
60
-        }else{
60
+        }else {
61 61
             $this->clone->cleanConfig($params);
62 62
         }
63 63
     }
Please login to merge, or discard this patch.
app/Console/Commands/CallPromotionCommand.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -48,21 +48,21 @@
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
app/Console/Commands/CloneConfigData.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -54,8 +54,8 @@  discard block
 block discarded – undo
54 54
         $academicPeriod = $this->academic_period->getAcademicPeriod($year);
55 55
         $mode = $this->argument('mode') == 'AL' ? true : false; 
56 56
         $previousAcademicPeriodYear = $academicPeriod->order;
57
-        $previousAcademicPeriod = Academic_period::where('order',$previousAcademicPeriodYear+1)->first();
58
-        $shift = $this->shifts->getShiftsToClone($previousAcademicPeriod->code,$this->argument(('max')),$mode);
57
+        $previousAcademicPeriod = Academic_period::where('order', $previousAcademicPeriodYear + 1)->first();
58
+        $shift = $this->shifts->getShiftsToClone($previousAcademicPeriod->code, $this->argument(('max')), $mode);
59 59
         $params = [
60 60
             'year' => $year,
61 61
             'academic_period' => $academicPeriod,
@@ -64,17 +64,17 @@  discard block
 block discarded – undo
64 64
         ];
65 65
 
66 66
         $function = array($this->clone, 'process');
67
-        if(count($shift) > 0){
67
+        if (count($shift) > 0) {
68 68
             // processParallel($function,$shift, $this->argument('max'),$params);
69
-            array_walk($shift,$function,$params);
70
-        }else{
69
+            array_walk($shift, $function, $params);
70
+        }else {
71 71
             $this->output->writeln('Nothing to clone');
72 72
         }
73 73
         $this->end_time = microtime(TRUE);
74 74
 
75 75
 
76 76
         $this->output->writeln('$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$');
77
-        $this->output->writeln('The cook took ' . ($this->end_time - $this->start_time) . ' seconds to complete');
77
+        $this->output->writeln('The cook took '.($this->end_time - $this->start_time).' seconds to complete');
78 78
         $this->output->writeln('$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$');
79 79
     }  
80 80
 }
Please login to merge, or discard this patch.
app/Console/Commands/PromoteStudents.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -65,15 +65,15 @@
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
app/Models/Education_grades_subject.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
         ;
Please login to merge, or discard this patch.
app/Models/Institution_subject.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
app/Models/Education_grade.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.