Ejemplo n.º 1
0
 public function getSpecificBatchRegionCount($batch)
 {
     $batch = $batch * 100000;
     $batchEnd = $batch + 100000;
     $regionArray = [];
     $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();
     $luzon = 0;
     $visayas = 0;
     $mindanao = 0;
     $unstated = 0;
     $luzonRegions = ['NCR', 'I', 'CAR', 'II', 'III', 'IV', 'V'];
     $visayasRegions = ['VI', 'VII', 'VIII'];
     $mindanaoRegions = ['IX', 'X', 'XI', 'XII', 'XIII', 'ARMM'];
     foreach ($collegeDropouts as $dropout) {
         $regionHolder = Studentaddress::getOneRegion($dropout->studentid);
         if (count($regionHolder) > 0) {
             $regionCode = preg_replace('/\\s+/', '', $regionHolder->regioncode);
             if (in_array($regionCode, $luzonRegions)) {
                 $luzon++;
             } elseif (in_array($regionCode, $visayasRegions)) {
                 $visayas++;
             } elseif (in_array($regionCode, $mindanaoRegions)) {
                 $mindanao++;
             }
         } else {
             $unstated++;
         }
     }
     $regionArray['Luzon'] = $luzon;
     $regionArray['Visayas'] = $visayas;
     $regionArray['Mindanao'] = $mindanao;
     $regionArray['Unstated'] = $unstated;
     return $regionArray;
 }
Ejemplo n.º 2
0
 public static function getOneRegion($studentId)
 {
     return Studentaddress::select('regions.regioncode')->join('cities', 'studentaddresses.cityid', '=', 'cities.cityid')->join('provinces', 'cities.provinceid', '=', 'provinces.provinceid')->join('regions', 'provinces.regionid', '=', 'regions.regionid')->where('studentaddresses.studentid', $studentId)->first();
 }
 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();
     }
 }
Ejemplo n.º 4
0
 public function getSpecificBatchRegionCount($batch)
 {
     $batch = $batch * 100000;
     $batchEnd = $batch + 100000;
     $regionArray = [];
     $programDropouts = Studentdropout::where('lastprogramid', $this->programid)->where('studentid', '>', $batch)->where('studentid', '<', $batchEnd)->get();
     $luzon = 0;
     $visayas = 0;
     $mindanao = 0;
     $unstated = 0;
     $luzonRegions = ['NCR', 'I', 'CAR', 'II', 'III', 'IV', 'V'];
     $visayasRegions = ['VI', 'VII', 'VIII'];
     $mindanaoRegions = ['IX', 'X', 'XI', 'XII', 'XIII', 'ARMM'];
     foreach ($programDropouts as $dropout) {
         $regionHolder = Studentaddress::getOneRegion($dropout->studentid);
         if (count($regionHolder) > 0) {
             if (in_array($regionHolder->regioncode, $luzonRegions)) {
                 $luzon++;
             } elseif (in_array($regionHolder->regioncode, $visayasRegions)) {
                 $visayas++;
             } elseif (in_array($regionHolder->regioncode, $mindanaoRegions)) {
                 $mindanao++;
             }
         } else {
             $unstated++;
         }
     }
     $regionArray['Luzon'] = $luzon;
     $regionArray['Visayas'] = $visayas;
     $regionArray['Mindanao'] = $mindanao;
     $regionArray['Unstated'] = $unstated;
     return $regionArray;
 }