@@ -30,17 +30,17 @@ discard block |
||
| 30 | 30 | |
| 31 | 31 | public function getStatisticsAttribute() |
| 32 | 32 | { |
| 33 | - $cachedStatistics = Cache::tags(['homework', 'statistics'])->get($this->id); |
|
| 33 | + $cachedStatistics=Cache::tags(['homework', 'statistics'])->get($this->id); |
|
| 34 | 34 | |
| 35 | 35 | if (blank($cachedStatistics)) { |
| 36 | - $cachedStatistics = $this->cacheStatistics(); |
|
| 36 | + $cachedStatistics=$this->cacheStatistics(); |
|
| 37 | 37 | } |
| 38 | 38 | |
| 39 | - if ($cachedStatistics === false) { |
|
| 39 | + if ($cachedStatistics===false) { |
|
| 40 | 40 | return null; |
| 41 | 41 | } |
| 42 | 42 | |
| 43 | - $cachedStatistics['timestamp'] = Carbon::createFromTimestamp($cachedStatistics['timestamp']); |
|
| 43 | + $cachedStatistics['timestamp']=Carbon::createFromTimestamp($cachedStatistics['timestamp']); |
|
| 44 | 44 | |
| 45 | 45 | return $cachedStatistics; |
| 46 | 46 | } |
@@ -48,25 +48,25 @@ discard block |
||
| 48 | 48 | public function cacheStatistics() |
| 49 | 49 | { |
| 50 | 50 | try { |
| 51 | - $statistics = []; |
|
| 52 | - $homeworkProblems = $this->problems->sortBy('order_index'); |
|
| 53 | - $users = $this->group->members()->where('role', '>=', 1)->get(); |
|
| 54 | - $userIDArr = $users->pluck('uid'); |
|
| 55 | - $defaultVerdict = []; |
|
| 51 | + $statistics=[]; |
|
| 52 | + $homeworkProblems=$this->problems->sortBy('order_index'); |
|
| 53 | + $users=$this->group->members()->where('role', '>=', 1)->get(); |
|
| 54 | + $userIDArr=$users->pluck('uid'); |
|
| 55 | + $defaultVerdict=[]; |
|
| 56 | 56 | |
| 57 | 57 | foreach ($homeworkProblems as $homeworkProblem) { |
| 58 | - $statistics['problems'][] = [ |
|
| 58 | + $statistics['problems'][]=[ |
|
| 59 | 59 | 'pid' => $homeworkProblem->problem_id, |
| 60 | 60 | 'readable_name' => $homeworkProblem->problem->readable_name, |
| 61 | 61 | ]; |
| 62 | - $defaultVerdict[$homeworkProblem->problem_id] = [ |
|
| 62 | + $defaultVerdict[$homeworkProblem->problem_id]=[ |
|
| 63 | 63 | "icon" => "checkbox-blank-circle-outline", |
| 64 | 64 | "color" => "wemd-grey-text" |
| 65 | 65 | ]; |
| 66 | 66 | } |
| 67 | 67 | |
| 68 | 68 | foreach ($users as $user) { |
| 69 | - $statistics['data'][$user->uid] = [ |
|
| 69 | + $statistics['data'][$user->uid]=[ |
|
| 70 | 70 | 'name' => $user->user->name, |
| 71 | 71 | 'nick_name' => blank($user->nick_name) ? null : $user->nick_name, |
| 72 | 72 | 'solved' => 0, |
@@ -75,44 +75,44 @@ discard block |
||
| 75 | 75 | ]; |
| 76 | 76 | } |
| 77 | 77 | |
| 78 | - $endedAt = Carbon::parse($this->ended_at); |
|
| 78 | + $endedAt=Carbon::parse($this->ended_at); |
|
| 79 | 79 | |
| 80 | 80 | foreach ($homeworkProblems as $homeworkProblem) { |
| 81 | - $userProbIDArr = []; |
|
| 81 | + $userProbIDArr=[]; |
|
| 82 | 82 | |
| 83 | 83 | foreach ($homeworkProblem->problem->users_latest_submission($userIDArr->diff($userProbIDArr), null, $endedAt, ['Accepted'])->get() as $acceptedRecord) { |
| 84 | - $statistics['data'][$acceptedRecord['uid']]['verdict'][$homeworkProblem->problem_id] = [ |
|
| 84 | + $statistics['data'][$acceptedRecord['uid']]['verdict'][$homeworkProblem->problem_id]=[ |
|
| 85 | 85 | "icon" => "checkbox-blank-circle", |
| 86 | 86 | "color" => $acceptedRecord['color'] |
| 87 | 87 | ]; |
| 88 | 88 | $statistics['data'][$acceptedRecord['uid']]['solved']++; |
| 89 | - $userProbIDArr[] = $acceptedRecord['uid']; |
|
| 89 | + $userProbIDArr[]=$acceptedRecord['uid']; |
|
| 90 | 90 | } |
| 91 | 91 | |
| 92 | 92 | foreach ($homeworkProblem->problem->users_latest_submission($userIDArr->diff($userProbIDArr), null, $endedAt, ['Partially Accepted'])->get() as $acceptedRecord) { |
| 93 | - $statistics['data'][$acceptedRecord['uid']]['verdict'][$homeworkProblem->problem_id] = [ |
|
| 93 | + $statistics['data'][$acceptedRecord['uid']]['verdict'][$homeworkProblem->problem_id]=[ |
|
| 94 | 94 | "icon" => "cisco-webex", |
| 95 | 95 | "color" => $acceptedRecord['color'] |
| 96 | 96 | ]; |
| 97 | 97 | $statistics['data'][$acceptedRecord['uid']]['attempted']++; |
| 98 | - $userProbIDArr[] = $acceptedRecord['uid']; |
|
| 98 | + $userProbIDArr[]=$acceptedRecord['uid']; |
|
| 99 | 99 | } |
| 100 | 100 | |
| 101 | 101 | foreach ($homeworkProblem->problem->users_latest_submission($userIDArr->diff($userProbIDArr), null, $endedAt)->get() as $acceptedRecord) { |
| 102 | - $statistics['data'][$acceptedRecord['uid']]['verdict'][$homeworkProblem->problem_id] = [ |
|
| 102 | + $statistics['data'][$acceptedRecord['uid']]['verdict'][$homeworkProblem->problem_id]=[ |
|
| 103 | 103 | "icon" => "cisco-webex", |
| 104 | 104 | "color" => $acceptedRecord['color'] |
| 105 | 105 | ]; |
| 106 | 106 | $statistics['data'][$acceptedRecord['uid']]['attempted']++; |
| 107 | - $userProbIDArr[] = $acceptedRecord['uid']; |
|
| 107 | + $userProbIDArr[]=$acceptedRecord['uid']; |
|
| 108 | 108 | } |
| 109 | 109 | } |
| 110 | 110 | |
| 111 | - usort($statistics['data'], function ($a, $b) { |
|
| 112 | - return $b["solved"] == $a["solved"] ? $b["attempted"] <=> $a["attempted"] : $b["solved"] <=> $a["solved"]; |
|
| 111 | + usort($statistics['data'], function($a, $b) { |
|
| 112 | + return $b["solved"]==$a["solved"] ? $b["attempted"] <=> $a["attempted"] : $b["solved"] <=> $a["solved"]; |
|
| 113 | 113 | }); |
| 114 | 114 | |
| 115 | - $statistics['timestamp'] = time(); |
|
| 115 | + $statistics['timestamp']=time(); |
|
| 116 | 116 | Cache::tags(['homework', 'statistics'])->put($this->id, $statistics, 360); |
| 117 | 117 | return $statistics; |
| 118 | 118 | } catch (Exception $e) { |
@@ -66,21 +66,21 @@ |
||
| 66 | 66 | |
| 67 | 67 | // Create Homework Itself |
| 68 | 68 | |
| 69 | - $newHomework = new GroupHomework(); |
|
| 69 | + $newHomework=new GroupHomework(); |
|
| 70 | 70 | |
| 71 | - $newHomework->title = $title; |
|
| 72 | - $newHomework->description = $description; |
|
| 73 | - $newHomework->ended_at = $endedAt; |
|
| 74 | - $newHomework->is_simple = 1; |
|
| 71 | + $newHomework->title=$title; |
|
| 72 | + $newHomework->description=$description; |
|
| 73 | + $newHomework->ended_at=$endedAt; |
|
| 74 | + $newHomework->is_simple=1; |
|
| 75 | 75 | $this->homework()->save($newHomework); |
| 76 | 76 | |
| 77 | 77 | // Created Related Problem List |
| 78 | 78 | |
| 79 | - $problemIndex = 1; |
|
| 79 | + $problemIndex=1; |
|
| 80 | 80 | foreach ($problems as $problem) { |
| 81 | - $newProblem = new GroupHomeworkProblem(); |
|
| 82 | - $newProblem->problem_id = $problem['pid']; |
|
| 83 | - $newProblem->order_index = $problemIndex++; |
|
| 81 | + $newProblem=new GroupHomeworkProblem(); |
|
| 82 | + $newProblem->problem_id=$problem['pid']; |
|
| 83 | + $newProblem->order_index=$problemIndex++; |
|
| 84 | 84 | $newHomework->problems()->save($newProblem); |
| 85 | 85 | } |
| 86 | 86 | |
@@ -11,13 +11,13 @@ discard block |
||
| 11 | 11 | |
| 12 | 12 | class Problem extends Model |
| 13 | 13 | { |
| 14 | - protected $table = 'problem'; |
|
| 15 | - protected $primaryKey = 'pid'; |
|
| 16 | - const UPDATED_AT = "update_date"; |
|
| 14 | + protected $table='problem'; |
|
| 15 | + protected $primaryKey='pid'; |
|
| 16 | + const UPDATED_AT="update_date"; |
|
| 17 | 17 | |
| 18 | 18 | public function getReadableNameAttribute() |
| 19 | 19 | { |
| 20 | - return $this->pcode . '. ' . $this->title; |
|
| 20 | + return $this->pcode.'. '.$this->title; |
|
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | public function submissions() |
@@ -45,16 +45,16 @@ discard block |
||
| 45 | 45 | return $this->getProblemStatus(); |
| 46 | 46 | } |
| 47 | 47 | |
| 48 | - public function getProblemStatus($userID = null, $contestID = null, Carbon $till = null) |
|
| 48 | + public function getProblemStatus($userID=null, $contestID=null, Carbon $till=null) |
|
| 49 | 49 | { |
| 50 | 50 | if (blank($userID)) { |
| 51 | 51 | if (Auth::guard('web')->check()) { |
| 52 | - $userID = Auth::guard('web')->user()->id; |
|
| 52 | + $userID=Auth::guard('web')->user()->id; |
|
| 53 | 53 | } |
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | if (filled($userID)) { |
| 57 | - $probStatus = $this->getProblemStatusFromDB($userID, $contestID, $till); |
|
| 57 | + $probStatus=$this->getProblemStatusFromDB($userID, $contestID, $till); |
|
| 58 | 58 | if (blank($probStatus)) { |
| 59 | 59 | return [ |
| 60 | 60 | "icon" => "checkbox-blank-circle-outline", |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | ]; |
| 63 | 63 | } else { |
| 64 | 64 | return [ |
| 65 | - "icon" => $probStatus->verdict == "Accepted" ? "checkbox-blank-circle" : "cisco-webex", |
|
| 65 | + "icon" => $probStatus->verdict=="Accepted" ? "checkbox-blank-circle" : "cisco-webex", |
|
| 66 | 66 | "color" => $probStatus->color |
| 67 | 67 | ]; |
| 68 | 68 | } |
@@ -74,11 +74,11 @@ discard block |
||
| 74 | 74 | } |
| 75 | 75 | } |
| 76 | 76 | |
| 77 | - private function getProblemStatusFromDB($userID, $contestID = null, Carbon $till = null) |
|
| 77 | + private function getProblemStatusFromDB($userID, $contestID=null, Carbon $till=null) |
|
| 78 | 78 | { |
| 79 | 79 | if (filled($contestID)) { |
| 80 | 80 | try { |
| 81 | - $endedAt = Carbon::parse(Contest::findOrFail($contestID)->endedAt); |
|
| 81 | + $endedAt=Carbon::parse(Contest::findOrFail($contestID)->endedAt); |
|
| 82 | 82 | } catch (Exception $e) { |
| 83 | 83 | return null; |
| 84 | 84 | } |
@@ -86,41 +86,41 @@ discard block |
||
| 86 | 86 | |
| 87 | 87 | // Get the very first AC record |
| 88 | 88 | |
| 89 | - $acRecords = $this->submissions()->where([ |
|
| 89 | + $acRecords=$this->submissions()->where([ |
|
| 90 | 90 | 'uid' => $userID, |
| 91 | 91 | 'cid' => $contestID, |
| 92 | 92 | 'verdict' => 'Accepted' |
| 93 | 93 | ]); |
| 94 | 94 | if (filled($contestID)) { |
| 95 | - $acRecords = $acRecords->where("submission_date", "<", $endedAt->timestamp); |
|
| 95 | + $acRecords=$acRecords->where("submission_date", "<", $endedAt->timestamp); |
|
| 96 | 96 | } |
| 97 | 97 | if (filled($till)) { |
| 98 | - $acRecords = $acRecords->where("submission_date", "<", $till->timestamp); |
|
| 98 | + $acRecords=$acRecords->where("submission_date", "<", $till->timestamp); |
|
| 99 | 99 | } |
| 100 | - $acRecords = $acRecords->orderBy('submission_date', 'desc')->first(); |
|
| 100 | + $acRecords=$acRecords->orderBy('submission_date', 'desc')->first(); |
|
| 101 | 101 | if (blank($acRecords)) { |
| 102 | - $pacRecords = $this->submissions()->where([ |
|
| 102 | + $pacRecords=$this->submissions()->where([ |
|
| 103 | 103 | 'uid' => $userID, |
| 104 | 104 | 'cid' => $contestID, |
| 105 | 105 | 'verdict' => 'Partially Accepted' |
| 106 | 106 | ]); |
| 107 | 107 | if (filled($contestID)) { |
| 108 | - $pacRecords = $pacRecords->where("submission_date", "<", $endedAt->timestamp); |
|
| 108 | + $pacRecords=$pacRecords->where("submission_date", "<", $endedAt->timestamp); |
|
| 109 | 109 | } |
| 110 | 110 | if (filled($till)) { |
| 111 | - $pacRecords = $pacRecords->where("submission_date", "<", $till->timestamp); |
|
| 111 | + $pacRecords=$pacRecords->where("submission_date", "<", $till->timestamp); |
|
| 112 | 112 | } |
| 113 | - $pacRecords = $pacRecords->orderBy('submission_date', 'desc')->first(); |
|
| 113 | + $pacRecords=$pacRecords->orderBy('submission_date', 'desc')->first(); |
|
| 114 | 114 | if (blank($pacRecords)) { |
| 115 | - $otherRecords = $this->submissions()->where([ |
|
| 115 | + $otherRecords=$this->submissions()->where([ |
|
| 116 | 116 | 'uid' => $userID, |
| 117 | 117 | 'cid' => $contestID |
| 118 | 118 | ]); |
| 119 | 119 | if (filled($contestID)) { |
| 120 | - $otherRecords = $otherRecords->where("submission_date", "<", $endedAt->timestamp); |
|
| 120 | + $otherRecords=$otherRecords->where("submission_date", "<", $endedAt->timestamp); |
|
| 121 | 121 | } |
| 122 | 122 | if (filled($till)) { |
| 123 | - $otherRecords = $otherRecords->where("submission_date", "<", $till->timestamp); |
|
| 123 | + $otherRecords=$otherRecords->where("submission_date", "<", $till->timestamp); |
|
| 124 | 124 | } |
| 125 | 125 | return $otherRecords->orderBy('submission_date', 'desc')->first(); |
| 126 | 126 | } |
@@ -130,27 +130,27 @@ discard block |
||
| 130 | 130 | } |
| 131 | 131 | } |
| 132 | 132 | |
| 133 | - public function users_latest_submission($users, $contestID = null, Carbon $till = null, $verdictFilter = []) |
|
| 133 | + public function users_latest_submission($users, $contestID=null, Carbon $till=null, $verdictFilter=[]) |
|
| 134 | 134 | { |
| 135 | 135 | if (filled($contestID)) { |
| 136 | - $endedAt = Carbon::parse(Contest::findOrFail($contestID)->endedAt); |
|
| 136 | + $endedAt=Carbon::parse(Contest::findOrFail($contestID)->endedAt); |
|
| 137 | 137 | } |
| 138 | 138 | |
| 139 | - $lastRecordSubQuery = $this->submissions()->select('uid', DB::raw('MAX(submission_date) as submission_date'))->whereIntegerInRaw('uid', $users)->where('cid', $contestID)->groupBy('uid'); |
|
| 139 | + $lastRecordSubQuery=$this->submissions()->select('uid', DB::raw('MAX(submission_date) as submission_date'))->whereIntegerInRaw('uid', $users)->where('cid', $contestID)->groupBy('uid'); |
|
| 140 | 140 | |
| 141 | 141 | if (filled($contestID)) { |
| 142 | - $lastRecordSubQuery = $lastRecordSubQuery->where("submission_date", "<", $endedAt->timestamp); |
|
| 142 | + $lastRecordSubQuery=$lastRecordSubQuery->where("submission_date", "<", $endedAt->timestamp); |
|
| 143 | 143 | } |
| 144 | 144 | |
| 145 | 145 | if (filled($till)) { |
| 146 | - $lastRecordSubQuery = $lastRecordSubQuery->where("submission_date", "<", $till->timestamp); |
|
| 146 | + $lastRecordSubQuery=$lastRecordSubQuery->where("submission_date", "<", $till->timestamp); |
|
| 147 | 147 | } |
| 148 | 148 | |
| 149 | - if(filled($verdictFilter)) { |
|
| 150 | - $lastRecordSubQuery = $lastRecordSubQuery->whereIn('verdict', $verdictFilter); |
|
| 149 | + if (filled($verdictFilter)) { |
|
| 150 | + $lastRecordSubQuery=$lastRecordSubQuery->whereIn('verdict', $verdictFilter); |
|
| 151 | 151 | } |
| 152 | 152 | |
| 153 | - $query = DB::table(DB::raw("({$lastRecordSubQuery->toSql()}) last_sub"))->leftJoinSub(Submission::toBase(), 'submissions', function ($join) { |
|
| 153 | + $query=DB::table(DB::raw("({$lastRecordSubQuery->toSql()}) last_sub"))->leftJoinSub(Submission::toBase(), 'submissions', function($join) { |
|
| 154 | 154 | $join->on('last_sub.submission_date', '=', 'submissions.submission_date')->on('last_sub.uid', '=', 'submissions.uid'); |
| 155 | 155 | })->select('sid', 'last_sub.submission_date as submission_date', 'last_sub.uid as uid', 'verdict', 'color')->orderBy('uid', 'ASC'); |
| 156 | 156 | |
@@ -12,7 +12,7 @@ discard block |
||
| 12 | 12 | * |
| 13 | 13 | * @var array |
| 14 | 14 | */ |
| 15 | - protected $dontReport = [ |
|
| 15 | + protected $dontReport=[ |
|
| 16 | 16 | // |
| 17 | 17 | ]; |
| 18 | 18 | |
@@ -21,7 +21,7 @@ discard block |
||
| 21 | 21 | * |
| 22 | 22 | * @var array |
| 23 | 23 | */ |
| 24 | - protected $dontFlash = [ |
|
| 24 | + protected $dontFlash=[ |
|
| 25 | 25 | 'current_password', |
| 26 | 26 | 'password', |
| 27 | 27 | 'password_confirmation', |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | */ |
| 35 | 35 | public function register() |
| 36 | 36 | { |
| 37 | - $this->reportable(function (Throwable $e) { |
|
| 37 | + $this->reportable(function(Throwable $e) { |
|
| 38 | 38 | // |
| 39 | 39 | }); |
| 40 | 40 | } |
@@ -78,10 +78,10 @@ discard block |
||
| 78 | 78 | $this->initSystemCheck(); |
| 79 | 79 | return; |
| 80 | 80 | if ($this->confirm('Do you wish to continue?')) { |
| 81 | - if(!$this->acceptLicense()){ |
|
| 81 | + if (!$this->acceptLicense()) { |
|
| 82 | 82 | return; |
| 83 | 83 | } |
| 84 | - if($this->createFrontAdminUser()){ |
|
| 84 | + if ($this->createFrontAdminUser()) { |
|
| 85 | 85 | $this->createFrontAdminGroup(); |
| 86 | 86 | } |
| 87 | 87 | $this->installBabelExtensionNOJ(); |
@@ -119,19 +119,19 @@ discard block |
||
| 119 | 119 | protected function createFrontAdminUser() { |
| 120 | 120 | $this->line('Creating frontstage admin user...'); |
| 121 | 121 | $this->comment(''); |
| 122 | - $shallCreate = true; |
|
| 122 | + $shallCreate=true; |
|
| 123 | 123 | if (User::count()) { |
| 124 | - $shallCreate = $this->confirm('Detected existing frontstage user, do you really want to create frontstage admin?'); |
|
| 124 | + $shallCreate=$this->confirm('Detected existing frontstage user, do you really want to create frontstage admin?'); |
|
| 125 | 125 | $this->comment(''); |
| 126 | 126 | } |
| 127 | 127 | if (!$shallCreate) { |
| 128 | 128 | return false; |
| 129 | 129 | } |
| 130 | - while(true) { |
|
| 130 | + while (true) { |
|
| 131 | 131 | try { |
| 132 | - $createdUser = $this->createFrontUser(); |
|
| 132 | + $createdUser=$this->createFrontUser(); |
|
| 133 | 133 | break; |
| 134 | - } catch(Exception $e) { |
|
| 134 | + } catch (Exception $e) { |
|
| 135 | 135 | $this->line("\n <bg=red;fg=white> Exception </> : <fg=yellow>Error occured while creating admin user.</>\n"); |
| 136 | 136 | continue; |
| 137 | 137 | } |
@@ -140,9 +140,9 @@ discard block |
||
| 140 | 140 | } |
| 141 | 141 | |
| 142 | 142 | private function createFrontUser() { |
| 143 | - $username = $this->ask('Please choose a username:', 'admin'); |
|
| 144 | - $email = $this->ask('Please choose a email address:', '[email protected]'); |
|
| 145 | - $password = Hash::make(Str::random(8)); |
|
| 143 | + $username=$this->ask('Please choose a username:', 'admin'); |
|
| 144 | + $email=$this->ask('Please choose a email address:', '[email protected]'); |
|
| 145 | + $password=Hash::make(Str::random(8)); |
|
| 146 | 146 | $createdUser=User::create([ |
| 147 | 147 | 'name' => $username, |
| 148 | 148 | 'email' => $email, |
@@ -180,27 +180,27 @@ discard block |
||
| 180 | 180 | return $socialites; |
| 181 | 181 | } |
| 182 | 182 | |
| 183 | - public function problems_latest_submission($problems, $contestID = null, Carbon $till = null, $verdictFilter = []) |
|
| 183 | + public function problems_latest_submission($problems, $contestID=null, Carbon $till=null, $verdictFilter=[]) |
|
| 184 | 184 | { |
| 185 | 185 | if (filled($contestID)) { |
| 186 | - $endedAt = Carbon::parse(Contest::findOrFail($contestID)->endedAt); |
|
| 186 | + $endedAt=Carbon::parse(Contest::findOrFail($contestID)->endedAt); |
|
| 187 | 187 | } |
| 188 | 188 | |
| 189 | - $lastRecordSubQuery = $this->submissions()->select('pid', DB::raw('MAX(submission_date) as submission_date'))->whereIntegerInRaw('pid', $problems)->where('cid', $contestID)->groupBy('pid'); |
|
| 189 | + $lastRecordSubQuery=$this->submissions()->select('pid', DB::raw('MAX(submission_date) as submission_date'))->whereIntegerInRaw('pid', $problems)->where('cid', $contestID)->groupBy('pid'); |
|
| 190 | 190 | |
| 191 | 191 | if (filled($contestID)) { |
| 192 | - $lastRecordSubQuery = $lastRecordSubQuery->where("submission_date", "<", $endedAt->timestamp); |
|
| 192 | + $lastRecordSubQuery=$lastRecordSubQuery->where("submission_date", "<", $endedAt->timestamp); |
|
| 193 | 193 | } |
| 194 | 194 | |
| 195 | 195 | if (filled($till)) { |
| 196 | - $lastRecordSubQuery = $lastRecordSubQuery->where("submission_date", "<", $till->timestamp); |
|
| 196 | + $lastRecordSubQuery=$lastRecordSubQuery->where("submission_date", "<", $till->timestamp); |
|
| 197 | 197 | } |
| 198 | 198 | |
| 199 | - if(filled($verdictFilter)) { |
|
| 200 | - $lastRecordSubQuery = $lastRecordSubQuery->whereIn('verdict', $verdictFilter); |
|
| 199 | + if (filled($verdictFilter)) { |
|
| 200 | + $lastRecordSubQuery=$lastRecordSubQuery->whereIn('verdict', $verdictFilter); |
|
| 201 | 201 | } |
| 202 | 202 | |
| 203 | - $query = DB::table(DB::raw("({$lastRecordSubQuery->toSql()}) last_sub"))->leftJoinSub(Submission::toBase(), 'submissions', function ($join) { |
|
| 203 | + $query=DB::table(DB::raw("({$lastRecordSubQuery->toSql()}) last_sub"))->leftJoinSub(Submission::toBase(), 'submissions', function($join) { |
|
| 204 | 204 | $join->on('last_sub.submission_date', '=', 'submissions.submission_date')->on('last_sub.pid', '=', 'submissions.pid'); |
| 205 | 205 | })->select('sid', 'last_sub.submission_date as submission_date', 'last_sub.pid as pid', 'verdict', 'color')->orderBy('pid', 'ASC'); |
| 206 | 206 | |
@@ -210,40 +210,40 @@ discard block |
||
| 210 | 210 | public function getDojoStatistics() |
| 211 | 211 | { |
| 212 | 212 | try { |
| 213 | - $statistics = []; |
|
| 214 | - $problemIDArr = DojoProblem::select('problem_id')->distinct()->get()->pluck('problem_id'); |
|
| 213 | + $statistics=[]; |
|
| 214 | + $problemIDArr=DojoProblem::select('problem_id')->distinct()->get()->pluck('problem_id'); |
|
| 215 | 215 | |
| 216 | 216 | foreach ($problemIDArr as $problemID) { |
| 217 | - $defaultVerdict[$problemID] = [ |
|
| 217 | + $defaultVerdict[$problemID]=[ |
|
| 218 | 218 | "icon" => "checkbox-blank-circle-outline", |
| 219 | 219 | "color" => "wemd-grey-text" |
| 220 | 220 | ]; |
| 221 | 221 | } |
| 222 | 222 | |
| 223 | - $problemCompleteIDArr = []; |
|
| 223 | + $problemCompleteIDArr=[]; |
|
| 224 | 224 | |
| 225 | 225 | foreach ($this->problems_latest_submission($problemIDArr->diff($problemCompleteIDArr), null, null, ['Accepted'])->get() as $acceptedRecord) { |
| 226 | - $statistics[$acceptedRecord['pid']] = [ |
|
| 226 | + $statistics[$acceptedRecord['pid']]=[ |
|
| 227 | 227 | "icon" => "checkbox-blank-circle", |
| 228 | 228 | "color" => $acceptedRecord['color'] |
| 229 | 229 | ]; |
| 230 | - $problemCompleteIDArr[] = $acceptedRecord['pid']; |
|
| 230 | + $problemCompleteIDArr[]=$acceptedRecord['pid']; |
|
| 231 | 231 | } |
| 232 | 232 | |
| 233 | 233 | foreach ($this->problems_latest_submission($problemIDArr->diff($problemCompleteIDArr), null, null, ['Partially Accepted'])->get() as $acceptedRecord) { |
| 234 | - $statistics[$acceptedRecord['pid']] = [ |
|
| 234 | + $statistics[$acceptedRecord['pid']]=[ |
|
| 235 | 235 | "icon" => "cisco-webex", |
| 236 | 236 | "color" => $acceptedRecord['color'] |
| 237 | 237 | ]; |
| 238 | - $problemCompleteIDArr[] = $acceptedRecord['pid']; |
|
| 238 | + $problemCompleteIDArr[]=$acceptedRecord['pid']; |
|
| 239 | 239 | } |
| 240 | 240 | |
| 241 | 241 | foreach ($this->problems_latest_submission($problemIDArr->diff($problemCompleteIDArr), null, null)->get() as $acceptedRecord) { |
| 242 | - $statistics[$acceptedRecord['pid']] = [ |
|
| 242 | + $statistics[$acceptedRecord['pid']]=[ |
|
| 243 | 243 | "icon" => "cisco-webex", |
| 244 | 244 | "color" => $acceptedRecord['color'] |
| 245 | 245 | ]; |
| 246 | - $problemCompleteIDArr[] = $acceptedRecord['pid']; |
|
| 246 | + $problemCompleteIDArr[]=$acceptedRecord['pid']; |
|
| 247 | 247 | } |
| 248 | 248 | |
| 249 | 249 | return $statistics; |
@@ -17,7 +17,7 @@ |
||
| 17 | 17 | */ |
| 18 | 18 | public function index(Request $request) |
| 19 | 19 | { |
| 20 | - $status = Auth::check() ? Auth::user()->getDojoStatistics() : false; |
|
| 20 | + $status=Auth::check() ? Auth::user()->getDojoStatistics() : false; |
|
| 21 | 21 | return view('dojo.index', [ |
| 22 | 22 | 'page_title' => "Dojo", |
| 23 | 23 | 'site_title' => config("app.name"), |
@@ -29,7 +29,7 @@ |
||
| 29 | 29 | |
| 30 | 30 | $result=$submissionModel->getWaitingSubmission(); |
| 31 | 31 | |
| 32 | - $submissionCount = count($result); |
|
| 32 | + $submissionCount=count($result); |
|
| 33 | 33 | |
| 34 | 34 | Log::channel('babel_judge_sync')->info("Currently $submissionCount submission(s) awaiting", [$result]); |
| 35 | 35 | |