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 seedGrades($batches, $allStudents, $collegeid) { foreach ($batches as $batch) { $students = $allStudents[$batch]; $totalFailing = 0; foreach ($students as $student) { if (Studentterm::getOneGradesCollege($student->studentid, $collegeid) > 3.0) { $totalFailing++; } } $newCorrelation = new Correlation(); $newCorrelation->factorid = 2; $newCorrelation->batch = $batch; $countStudents = count($students); if ($countStudents > 0) { $newCorrelation->ratio = $totalFailing / $countStudents; } else { $newCorrelation->ratio = 0; } $newCorrelation->unittype = 'college'; $newCorrelation->collegeid = $collegeid; $newCorrelation->save(); } }