/**
  * Run the migrations.
  *
  * @return void
  */
 public function up()
 {
     Schema::table('correlations', function (Blueprint $table) {
         //
     });
     $batches = [2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009];
     foreach ($batches as $batch) {
         $students = Studentterm::getBatchStudents($batch * 100000);
         $totalUnderload = 0;
         $totalNodata = 0;
         foreach ($students as $student) {
             $units = Assessment::getOneAveUnits($student->studentid);
             if ($units === -1) {
                 $totalNodata++;
             } else {
                 if ($units < 15) {
                     $totalUnderload++;
                 } else {
                 }
             }
         }
         $newEntry = new Correlation();
         $newEntry->factorid = 6;
         $newEntry->batch = $batch;
         $newEntry->ratio = $totalUnderload / (count($students) - $totalNodata);
         $newEntry->save();
     }
 }
 public function addEntries()
 {
     $batches = [2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009];
     $allStudents = [];
     foreach ($batches as $batch) {
         $allStudents[$batch] = Studentterm::getBatchStudents($batch * 100000);
     }
     $this->seedUnemployment($batches, $allStudents);
     $this->seedHighGrades($batches, $allStudents);
     $this->seedOverload($batches, $allStudents);
 }
 /**
  * Run the migrations.
  *
  * @return void
  */
 public function up()
 {
     Schema::table('correlations', function (Blueprint $table) {
         //
     });
     $batches = [2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009];
     $allStudents = [];
     foreach ($batches as $batch) {
         $allStudents[$batch] = Studentterm::getBatchStudents($batch * 100000);
     }
     $this->alterStbracket($batches, $allStudents);
 }
 public function seedCorrelations()
 {
     $batches = [2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009];
     $allStudents = [];
     foreach ($batches as $batch) {
         $allStudents[$batch] = Studentterm::getBatchStudents($batch * 100000);
     }
     $this->seedEmployment($batches, $allStudents);
     $this->seedGrades($batches, $allStudents);
     $this->seedStbracket($batches, $allStudents);
     $this->seedRegion($batches, $allStudents);
 }