public function seedHighGrades($batches, $allStudents, $collegeid) { foreach ($batches as $batch) { $students = $allStudents[$batch]; $totalHigh = 0; foreach ($students as $student) { $gwa = Studentterm::getOneGradesCollege($student->studentid, $collegeid); if ($gwa > 1.0 || $gwa < 3.0) { $totalHigh++; } } $newCorrelation = new Correlation(); $newCorrelation->factorid = 7; $newCorrelation->batch = $batch; $countStudents = count($students); if ($countStudents > 0) { $newCorrelation->ratio = $totalHigh / $countStudents; } else { $newCorrelation->ratio = 0; } $newCorrelation->unittype = 'college'; $newCorrelation->collegeid = $collegeid; $newCorrelation->save(); } }
public function seedUnits($batches, $allStudents, $collegeid) { foreach ($batches as $batch) { $students = $allStudents[$batch]; $totalUnderload = 0; $totalNodata = 0; foreach ($students as $student) { $units = Assessment::getOneAveUnitsCollege($student->studentid, $collegeid); if ($units === -1) { $totalNodata++; } else { if ($units < 15) { $totalUnderload++; } else { } } } $newCorrelation = new Correlation(); $newCorrelation->factorid = 6; $newCorrelation->batch = $batch; $countStudents = count($students); if ($countStudents - $totalNodata > 0) { $newCorrelation->ratio = $totalUnderload / ($countStudents - $totalNodata); } else { $newCorrelation->ratio = 0; } $newCorrelation->unittype = 'college'; $newCorrelation->collegeid = $collegeid; $newCorrelation->save(); } }
public function seedUnemployment($batches, $allStudents, $collegeid) { foreach ($batches as $batch) { $students = $allStudents[$batch]; $totalUnemployed = 0; foreach ($students as $student) { $results = Studentterm::getOneEmploymentCollege($student->studentid, $collegeid); $unemployed = 0; foreach ($results as $result) { if ($result->employment === 'N') { $unemployed = 1; } } $totalUnemployed = $totalUnemployed + $unemployed; } $newCorrelation = new Correlation(); $newCorrelation->factorid = 8; $newCorrelation->batch = $batch; $countStudents = count($students); if ($countStudents > 0) { $newCorrelation->ratio = $totalUnemployed / $countStudents; } else { $newCorrelation->ratio = 0; } $newCorrelation->unittype = 'college'; $newCorrelation->collegeid = $collegeid; $newCorrelation->save(); } }
/** * 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 seedRegion($batches, $allStudents) { $regions = ['VI', 'VII', 'VIII', 'IX', 'X', 'XI', 'XII', 'XIII', 'ARMM']; foreach ($batches as $batch) { $totalFar = 0; $students = $allStudents[$batch]; foreach ($students as $student) { $regionHolder = Studentaddress::getOneRegion($student->studentid); if (count($regionHolder) > 0) { if (in_array($regionHolder->regioncode, $regions)) { $totalFar++; } } } $newCorrelation = new Correlation(); $newCorrelation->factorid = 4; $newCorrelation->batch = $batch; $newCorrelation->ratio = $totalFar / count($students); $newCorrelation->save(); } }
public function seedOverload($batches, $allStudents) { foreach ($batches as $batch) { $students = $allStudents[$batch]; $totalOverload = 0; $totalNodata = 0; foreach ($students as $student) { $units = Assessment::getOneAveUnits($student->studentid); if ($units === -1) { $totalNodata++; } else { if ($units > 18) { $totalOverload++; } else { } } } $newCorrelation = new Correlation(); $newCorrelation->factorid = 9; $newCorrelation->batch = $batch; $newCorrelation->ratio = $totalOverload / (count($students) - $totalNodata); $newCorrelation->save(); } }