예제 #1
0
 public function getBatchDropouts()
 {
     $batchDropouts = [];
     $batches = [200000000, 200100000, 200200000, 200300000, 200400000, 200500000, 200600000, 200700000, 200800000, 200900000];
     foreach ($batches as $batch) {
         $allBatchStudents = Studentterm::getBatchStudentsCount($batch);
         $allBatchDropouts = Studentdropout::getBatchDropoutsCount($batch);
         $batchDropouts[$batch / 100000] = round($allBatchDropouts / $allBatchStudents * 100, 2);
     }
     return $batchDropouts;
 }
 public function seedCampus($entry)
 {
     $batch = $entry->batch;
     $dropouts = Studentdropout::getBatchDropoutsCount($batch * 100000);
     $students = Studentterm::getBatchStudentsCount($batch * 100000);
     if ($students > 0) {
         $entry->dropouts = $dropouts / $students;
     } else {
         $entry->dropouts = 0;
     }
     $entry->save();
 }
 /**
  * Run the migrations.
  *
  * @return void
  */
 public function up()
 {
     Schema::table('correlations', function (Blueprint $table) {
         //
     });
     $entries = Correlation::where('unittype', 'campus')->get();
     foreach ($entries as $entry) {
         $batch = $entry->batch;
         $dropouts = Studentdropout::getBatchDropoutsCount($batch * 100000);
         $delayed = Studentdelayed::getBatchDelayedCount($batch * 100000);
         $students = Studentterm::getBatchStudentsCount($batch * 100000);
         if ($students > 0) {
             $entry->dropouts = ($dropouts + $delayed) / $students;
         } else {
             $entry->dropouts = 0;
         }
         $entry->save();
     }
 }