Esempio n. 1
0
 function complete($id, $complete = true)
 {
     $complete = filter_var($complete, FILTER_VALIDATE_BOOLEAN);
     if (HomeworkSource::mark_complete($id, $complete)) {
         User::active()->mark_homework_complete($id, $complete);
         return 'true';
     }
     return 'false';
 }
Esempio n. 2
0
 /**
  * Execute the command.
  *
  * @return void
  */
 public function handle()
 {
     if ($this->user->is_queued) {
         $time_start = microtime(true) . "s\n";
         echo 'Preparing user: '******'Time: ' . ($time_end - $time_start) . "s\n";
         if ($this->user->is_queued <= 3) {
             $this->user->is_queued = 3;
             $this->user->save();
             echo "Notifications\n";
             NotificationsSource::update($this->user);
         }
         $time_end = microtime(true);
         echo 'Time: ' . ($time_end - $time_start) . "s\n";
         if ($this->user->is_queued <= 4) {
             $this->user->is_queued = 4;
             $this->user->save();
             echo "PastoralCare\n";
             PastoralCareSource::update($this->user);
         }
         $time_end = microtime(true);
         echo 'Time: ' . ($time_end - $time_start) . "s\n";
         if ($this->user->is_queued <= 5) {
             $this->user->is_queued = 5;
             $this->user->save();
             echo "SportsZone\n";
             SportsZoneSource::update($this->user);
         }
         $time_end = microtime(true);
         echo 'Time: ' . ($time_end - $time_start) . "s\n";
         if ($this->user->is_queued <= 6) {
             $this->user->is_queued = 6;
             $this->user->save();
             echo "Timetable\n";
             TimetableSource::update($this->user);
         }
         $time_end = microtime(true);
         echo 'Time: ' . ($time_end - $time_start) . "s\n";
         $this->user->is_queued = 0;
         $this->user->save();
         $time_end = microtime(true);
         echo 'Time: ' . ($time_end - $time_start) . "s\n";
     }
     $this->user->save();
 }
Esempio n. 3
0
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle()
 {
     $this->log_wake();
     $errors = 0;
     foreach (User::all() as $index => $user) {
         $this->log_section('User ' . $user->user_id);
         try {
             HomeworkSource::update($user);
             $this->log_section_end('Completed successfully.');
         } catch (\Exception $e) {
             $errors++;
             $this->comment('Exception');
             $this->error($e);
             $this->log_section_end('Failed.', true);
         }
     }
     $this->info("Completed with {$errors} errors.");
     if ($errors != 0) {
         $this->dispatch("Homework");
     }
 }
Esempio n. 4
0
<?php

use App\Next\Next;
Next::hello();
use App\Next\Data\HomeworkSource;
use App\Next\Layout\Colours;
use App\Next\Data\Cache;
use App\Next\Models\Homework;
use App\Next\Models\User;
// var_dump(Cache::update_cache_date('HomeworkSource'));
DB::table('homework')->delete();
DB::table('users_homework')->delete();
var_dump(HomeworkSource::parsed_data());
// var_dump(Homework::all());
$user = User::find(60829);
foreach ($user->homework as $tree) {
    echo $tree->homework_id . ':' . $tree->pivot->complete . '<br>';
}