/**
  * Run the migrations.
  *
  * @return void
  */
 public function up()
 {
     Schema::create('studentdelayed', function (Blueprint $table) {
         $table->increments('id');
         $table->integer('studentid');
         $table->integer('programid');
         $table->integer('collegeid');
         $table->integer('semesters');
         $table->timestamps();
     });
     $students = Studentdropout::select('studentid', 'programid', 'collegeid', 'semesters')->where('semesters', '>', 8)->get();
     foreach ($students as $student) {
         $programid = $student->programid;
         $semesters = $student->semesters;
         $programYears = Program::select('numyears')->where('programid', $programid)->first()->numyears;
         if ($semesters > $programYears * 2) {
             $newEntry = new Studentdelayed();
             $newEntry->studentid = $student->studentid;
             $newEntry->programid = $programid;
             $newEntry->collegeid = $student->collegeid;
             $newEntry->semesters = $semesters;
             $newEntry->save();
         }
     }
 }
 /**
  * Run the migrations.
  *
  * @return void
  */
 public function up()
 {
     Schema::table('correlations', function (Blueprint $table) {
         //
     });
     $entries = Correlation::where('unittype', 'program')->get();
     foreach ($entries as $entry) {
         $batch = $entry->batch;
         $programid = $entry->programid;
         $dropoutsRaw = Studentdropout::getBatchDropoutsProgram($batch * 100000, $programid);
         $shiftsRaw = Studentshift::getBatchShiftsProgram($batch * 100000, $programid);
         $delayedRaw = Studentdelayed::getBatchDelayedProgram($batch * 100000, $programid);
         $studentids = [];
         foreach ($dropoutsRaw as $doRaw) {
             array_push($studentids, $doRaw->studentid);
         }
         foreach ($shiftsRaw as $sRaw) {
             array_push($studentids, $sRaw->studentid);
         }
         foreach ($delayedRaw as $dRaw) {
             array_push($studentids, $dRaw->studentid);
         }
         $studentids = array_values(array_unique($studentids));
         $students = Studentterm::getBatchStudentsCountProgram($batch * 100000, $programid);
         if ($students > 0) {
             $entry->dropouts = count($studentids) / $students;
         } else {
             $entry->dropouts = 0;
         }
         $entry->save();
     }
 }
Example #3
0
 public function getBatchDelayed()
 {
     $batchDelayed = [];
     $batches = [200000000, 200100000, 200200000, 200300000, 200400000, 200500000, 200600000, 200700000, 200800000, 200900000];
     foreach ($batches as $batch) {
         $allBatchDelayed = Studentdelayed::getBatchDelayedCount($batch);
         $allBatchStudents = Studentterm::getBatchStudentsCount($batch);
         $batchDelayed[$batch / 100000] = round($allBatchDelayed / $allBatchStudents * 100, 2);
     }
     return $batchDelayed;
 }
 /**
  * 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();
     }
 }
Example #5
0
 public function getBatchDelayedRate()
 {
     $batchDelayedRate = [];
     $programids = $this->programs()->whereNotIn('programid', array(62, 66, 38, 117))->where('degreelevel', 'U')->lists('programid');
     //To get batches of program whithin 2000-2009
     $progYears = Studentterm::whereIn('programid', $programids)->groupBy('year')->orderBy('year', 'asc')->lists('year');
     $max = 2009;
     $batches = [];
     foreach ($progYears as $progYear) {
         if ($progYear > 1999 && $progYear < $max + 1) {
             array_push($batches, $progYear * 100000);
         }
     }
     foreach ($batches as $batch) {
         $batchEnd = $batch + 100000;
         $allBatchStudents = count(Studentterm::select('studentid')->where('studentid', '>', $batch)->where('studentid', '<', $batchEnd)->whereIn('programid', $programids)->groupBy('studentid')->get());
         $allBatchDelayed = Studentdelayed::getBatchDelayedCountCollege($batch, $this->unitid);
         $batchDelayedRate[$batch / 100000] = round($allBatchDelayed / $allBatchStudents * 100, 2);
     }
     return $batchDelayedRate;
 }
Example #6
0
 public static function getBatchDelayedCollege($batch, $collegeid)
 {
     $batchEnd = $batch + 100000;
     $programids = Studentdelayed::getCollPrograms($collegeid);
     return Studentdelayed::select('studentid')->where('studentid', '>=', $batch)->where('studentid', '<', $batchEnd)->whereIn('programid', $programids)->get();
 }
Example #7
0
 public function getBatchDelayedRate()
 {
     $batchDelayedRate = [];
     //To get batches of program whithin 2000-2009
     $progYears = Studentterm::where('programid', $this->programid)->groupBy('year')->orderBy('year', 'asc')->lists('year');
     if ($this->revisionyear > 2009) {
         $max = 2012;
     } else {
         if ($this->programid == 28) {
             $max = 2013 - 4;
         } else {
             $max = 2013 - $this->numyears;
         }
     }
     $batches = [];
     foreach ($progYears as $progYear) {
         if ($progYear > 1999 && $progYear < $max + 1) {
             array_push($batches, $progYear * 100000);
         }
     }
     foreach ($batches as $batch) {
         $batchEnd = $batch + 100000;
         $allBatchStudents = count(Studentterm::select('studentid')->where('studentid', '>', $batch)->where('studentid', '<', $batchEnd)->where('programid', $this->programid)->groupBy('studentid')->get());
         $allBatchDelayed = Studentdelayed::getBatchDelayedCountProgram($batch, $this->programid);
         $batchDelayedRate[$batch / 100000] = round($allBatchDelayed / $allBatchStudents * 100, 2);
     }
     return $batchDelayedRate;
 }