@@ -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 | - $statistics[$problemID] = [ |
|
| 217 | + $statistics[$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; |