@@ -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 | |