コード例 #1
0
ファイル: Submission.php プロジェクト: alexpizarroj/orange
 public static function createFromRequest(SubmitSolutionRequest $request, Problem $problem, Contest $contest = null)
 {
     assert(Auth::check());
     assert($request->isFileFieldOK('source'));
     $source = $request->popSourceInfo();
     $verdict = $problem->getSubmissionVerdict($source['content'], $source['ext']);
     $data = ['user_id' => Auth::user()->id, 'contest_id' => !is_null($contest) ? $contest->id : null, 'problem_id' => $problem->id, 'source' => $source['content'], 'source_kind' => $source['ext'], 'verdict' => $verdict];
     return Submission::create($data);
 }
コード例 #2
0
 public function submit($problem_id, Requests\SubmitSolutionRequest $request)
 {
     if (!$request->isFileFieldOK('source')) {
         abort(409, 'No se completó el envío del archivo al servidor.');
     }
     $problem = Problem::findOrFail($problem_id);
     Submission::createFromRequest($request, $problem);
     return redirect(action('UsersController@submissions', Auth::user()->id));
 }
コード例 #3
0
 /**
  * 솔루션 생성
  *
  * @param array $request
  * @return App\Models\Solution
  */
 public function createSolution(array $request)
 {
     if (Problem::findOrFail($request['problem_id'])->status != Problem::openCode) {
         abort(404);
     }
     $code = $request['code'];
     $request['user_id'] = $this->user->id;
     $request = array_only($request, Solution::$editable);
     $request = array_add($request, 'code', $code);
     return $this->service->createSolution($request);
 }
コード例 #4
0
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit($id)
 {
     $types = Problem::lists('problem_types', 'problem_types');
     $area = Area::lists('area', 'area');
     $complaint = Complaint::findOrFail($id);
     $disable = 1;
     return view('complaints.edit', compact('complaint', 'types', 'area', 'disable'));
 }
コード例 #5
0
 public function create($problem_id)
 {
     $problem = Problem::findOrFail($problem_id);
     return view('problems.testcases.create', compact('problem'));
 }