public function seedGrades($batches, $allStudents) { foreach ($batches as $batch) { $students = $allStudents[$batch]; $totalFailing = 0; foreach ($students as $student) { if (Studentterm::getOneGrades($student->studentid) > 3.0) { $totalFailing++; } } $newCorrelation = new Correlation(); $newCorrelation->factorid = 2; $newCorrelation->batch = $batch; $newCorrelation->ratio = $totalFailing / count($students); $newCorrelation->save(); } }
public function seedHighGrades($batches, $allStudents) { foreach ($batches as $batch) { $students = $allStudents[$batch]; $totalHigh = 0; foreach ($students as $student) { $gwa = Studentterm::getOneGrades($student->studentid); if ($gwa > 0.0 || $gwa < 3.0) { $totalHigh++; } } $newCorrelation = new Correlation(); $newCorrelation->factorid = 7; $newCorrelation->batch = $batch; $newCorrelation->ratio = $totalHigh / count($students); $newCorrelation->save(); } }