public function seedStbracket($batches, $allStudents, $programid)
 {
     foreach ($batches as $batch) {
         $students = $allStudents[$batch];
         $totalPoor = 0;
         foreach ($students as $student) {
             $results = Studentterm::getOneStbracketProgram($student->studentid, $programid);
             $poor = 0;
             foreach ($results as $result) {
                 if (strpos($result->stfapbracket, 'A') !== false || strpos($result->stfapbracket, 'B') !== false || strpos($result->stfapbracket, '8') !== false || strpos($result->stfapbracket, '9') !== false) {
                     $poor = 1;
                 }
             }
             $totalPoor = $totalPoor + $poor;
         }
         $newCorrelation = new Correlation();
         $newCorrelation->factorid = 3;
         $newCorrelation->batch = $batch;
         $countStudents = count($students);
         if ($countStudents > 0) {
             $newCorrelation->ratio = $totalPoor / $countStudents;
         } else {
             $newCorrelation->ratio = 0;
         }
         $newCorrelation->unittype = 'program';
         $newCorrelation->programid = $programid;
         $newCorrelation->save();
     }
 }