public function seedEmployment($batches, $allStudents) { foreach ($batches as $batch) { $students = $allStudents[$batch]; $totalEmployed = 0; foreach ($students as $student) { $results = Studentterm::getOneEmployment($student->studentid); $employed = 0; foreach ($results as $result) { if ($result->employment === 'F' || $result->employment === 'P') { $employed = 1; } } $totalEmployed = $totalEmployed + $employed; } $newCorrelation = new Correlation(); $newCorrelation->factorid = 1; $newCorrelation->batch = $batch; $newCorrelation->ratio = $totalEmployed / count($students); $newCorrelation->save(); } }
public function getSpecificBatchEmploymentCount($batch) { //format is year $batch = $batch * 100000; $batchEnd = $batch + 100000; $employmentArray = []; $programids = Program::whereNotIn('programid', array(62, 66, 38, 22))->where('degreelevel', 'U')->lists('programid'); $collegeDropouts = Studentdropout::whereIn('lastprogramid', $programids)->where('studentid', '>', $batch)->where('studentid', '<', $batchEnd)->get(); $dropoutCount = count($collegeDropouts); $employed = 0; $unemployed = 0; foreach ($collegeDropouts as $dropout) { $results = Studentterm::getOneEmployment($dropout->studentid); foreach ($results as $result) { if (strpos($result->employment, 'F') !== false || strpos($result->employment, 'P') !== false) { $employed++; break; } } } $unemployed = $dropoutCount - $employed; $employmentArray['Employed'] = round($employed / $dropoutCount * 100, 2); $employmentArray['Unemployed'] = round($unemployed / $dropoutCount * 100, 2); return $employmentArray; }
public function getSpecificBatchEmploymentCount($batch) { //format is year $batch = $batch * 100000; $batchEnd = $batch + 100000; $employmentArray = []; $programids = $this->programs()->whereNotIn('programid', array(62, 66, 38, 117))->where('degreelevel', 'U')->lists('programid'); $departmentDropouts = Studentdropout::whereIn('lastprogramid', $programids)->where('studentid', '>', $batch)->where('studentid', '<', $batchEnd)->get(); $dropoutCount = count($departmentDropouts); $employed = 0; $unemployed = 0; foreach ($departmentDropouts as $dropout) { $results = Studentterm::getOneEmployment($dropout->studentid); $duplicate = 0; foreach ($results as $result) { if ($result->employment === 'F' || $result->employment === 'P') { if ($duplicate === 0) { $employed++; $duplicate++; } } } } $unemployed = $dropoutCount - $employed; $employmentArray['Employed'] = round($employed / $dropoutCount * 100, 2); $employmentArray['Unemployed'] = round($unemployed / $dropoutCount * 100, 2); return $employmentArray; }