Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scrutinizer Auto-Fixes #266

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/Console/Commands/CallPromotionCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,6 @@ public function handle()
{
$year = $this->argument('year');
$institution = $this->instituion_grade->getInstitutionGradeList($year);
$this->call('promote:students',['year' => $year,'institution' => $institution->code]);
$this->call('promote:students', ['year' => $year, 'institution' => $institution->code]);
}
}
50 changes: 25 additions & 25 deletions app/Console/Commands/CloneConfigData.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ public function __construct()
$this->academic_period = new Academic_period();
$this->institution_classes = new Institution_class();
$this->institution_class_subjects = new Institution_class_subject();
$this->institution_subjects = new Institution_subject();
$this->education_grade_subjects = new Education_grades_subject();
$this->institution_subjects = new Institution_subject();
$this->education_grade_subjects = new Education_grades_subject();
$this->output = new \Symfony\Component\Console\Output\ConsoleOutput();
}

Expand All @@ -76,9 +76,9 @@ public function handle()
$this->end_time = microtime(TRUE);


$this->output->writeln('$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$');
$this->output->writeln('The cook took ' . ($this->end_time - $this->start_time) . ' seconds to complete');
$this->output->writeln('$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$');
$this->output->writeln('$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$');
$this->output->writeln('The cook took ' . ($this->end_time - $this->start_time) . ' seconds to complete');
$this->output->writeln('$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$');

}

Expand Down Expand Up @@ -113,13 +113,13 @@ public function process($shift,$count,$params){
$this->output->writeln('updating from '. $shiftId);

}catch (\Exception $e){
Log::error($e->getMessage(),[$e]);
Log::error($e->getMessage(),[$e]);
}
}
// DB::commit();
}catch (\Exception $e){
// DB::rollBack();
Log::error($e->getMessage(),[$e]);
Log::error($e->getMessage(),[$e]);
}
}

Expand All @@ -130,16 +130,16 @@ public function process($shift,$count,$params){
* @param $academicPeriod
*/
public function insertInstitutionSubjects($subjects, $count,$academicPeriod){
try{
$subjects['academic_period_id'] = $academicPeriod->id;
$subjects['created'] = now();
unset($subjects['total_male_students']);
unset($subjects['total_female_students']);
unset($subjects['id']);
$classSubject = Institution_subject::create($subjects);
}catch (\Exception $e){
try{
$subjects['academic_period_id'] = $academicPeriod->id;
$subjects['created'] = now();
unset($subjects['total_male_students']);
unset($subjects['total_female_students']);
unset($subjects['id']);
$classSubject = Institution_subject::create($subjects);
}catch (\Exception $e){
Log::error($e->getMessage(),[$e]);
}
}
}


Expand Down Expand Up @@ -181,7 +181,7 @@ public function insertInstitutionClasses($class,$count,$param){
$this->insertInstitutionClassSubjects($institutionSubjects,$class);
// array_walk($classSubjects,array($this,'insertInstitutionClassSubjects'),$params);
}catch (\Exception $e){
Log::error($e->getMessage(),[$e]);
Log::error($e->getMessage(),[$e]);
}
}

Expand All @@ -191,7 +191,7 @@ public function insertInstitutionClassSubjects($subjects,$class){
array_walk($subjects,array($this,'insertClassSubjects'),$class);
$this->output->writeln('updating subjects '. $class->name);
}catch (\Exception $e){
Log::error($e->getMessage(),[$e]);
Log::error($e->getMessage(),[$e]);
}
};
}
Expand All @@ -209,7 +209,7 @@ public function insertClassSubjects($subject,$count,$newClassId){
$this->institution_class_subjects->create($subjectobj);
}
}catch (\Exception $e){
Log::error($e->getMessage(),[$e]);
Log::error($e->getMessage(),[$e]);
}
}

Expand All @@ -221,15 +221,15 @@ public function insertClassSubjects($subject,$count,$newClassId){
* @param $academicPeriod
* @return array
*/
public function generateNewClass($classes,$shiftId,$academicPeriod){
public function generateNewClass($classes, $shiftId, $academicPeriod) {
$newClasses = [];
foreach ( $classes as $class) {
foreach ($classes as $class) {
$noOfStudents = $class['no_of_students'] == 0 ? 40 : $class['no_of_students'];
$class['academic_period_id'] = $academicPeriod;
$class['no_of_students'] = $noOfStudents;
$class['created'] = now();
$class['institution_shift_id'] = $shiftId;
array_push($newClasses,$class);
array_push($newClasses, $class);
}
return $newClasses;
}
Expand All @@ -240,11 +240,11 @@ public function generateNewClass($classes,$shiftId,$academicPeriod){
* @param $shift
* @return mixed
*/
public function updateShifts($year,$shift){
public function updateShifts($year, $shift) {
$academicPeriod = $this->academic_period->getAcademicPeriod($year);
$this->shifts->where('id',$shift['id'])->update(['cloned' => '2020']);
$this->shifts->where('id', $shift['id'])->update(['cloned' => '2020']);
$shift['academic_period_id'] = $academicPeriod->id;
$exist = $this->shifts->shiftExists($shift);
return $this->shifts->create((array)$shift)->id;
return $this->shifts->create((array) $shift)->id;
}
}
Loading