コード例 #1
0
 public function save(Request $request, $id)
 {
     $status = new Status();
     $status->problem_id = $id;
     $status->user_id = '0';
     $status->time = '0';
     $status->memory = '0';
     $leng = $request->input('leng');
     $status->language = $leng;
     //$status->source_code=
     $status->save();
     $status = Status::orderby('solution_id', 'desc')->first();
     $compile = new Compileinfo();
     $compile->solution_id = $status->solution_id;
     $compile->save();
     $code = new Source_code();
     $code->solution_id = $status->solution_id;
     $code->source = $request->input('editor');
     $code->save();
     $code = Source_code::orderby('sourcecode_id', 'desc')->first();
     $run = new Run();
     $run->solution_id = $status->solution_id;
     $run->problem_id = $id;
     $run->language = $leng;
     $run->sourcecode_id = $code->sourcecode_id;
     $run->save();
     return redirect('status/status');
 }
コード例 #2
0
ファイル: RunSuiteTableSeeder.php プロジェクト: cwelect1/ART
 public function run()
 {
     $run = \App\Run::find(1);
     $run->suites()->save(\App\Suite::find(3));
     $run = \App\Run::find(2);
     $run->suites()->save(\App\Suite::find(7));
     $run = \App\Run::find(3);
     $run->suites()->save(\App\Suite::find(11));
     $run = \App\Run::find(4);
     $run->suites()->save(\App\Suite::find(2));
     $run = \App\Run::find(5);
     $run->suites()->save(\App\Suite::find(4));
     $run = \App\Run::find(6);
     $run->suites()->save(\App\Suite::find(8));
     $run = \App\Run::find(7);
     $run->suites()->save(\App\Suite::find(12));
     $run = \App\Run::find(8);
     $run->suites()->save(\App\Suite::find(5));
     $run = \App\Run::find(9);
     $run->suites()->save(\App\Suite::find(9));
     $run = \App\Run::find(10);
     $run->suites()->save(\App\Suite::find(13));
     $run = \App\Run::find(11);
     $run->suites()->save(\App\Suite::find(14));
 }
コード例 #3
0
 public function create()
 {
     $runs = Run::lists('description', 'id');
     $batches = Batch::whereHas('samples', function ($query) {
         $query->where('runs_remaining', '>', 0);
     })->get();
     return view('sampleRuns.create', ['runs' => $runs, 'batches' => $batches]);
 }
コード例 #4
0
ファイル: RunsController.php プロジェクト: famorted/seqtrack
 /**
  * @param Request $request
  * @return string
  */
 public function setStatus(Request $request)
 {
     $input = $request->all();
     $run = Run::where('id', $input['run_id'])->first();
     // existing run status is either run built or run succeeded and new value is run failed
     // increment all samples in run by one
     if (($run->run_status_id == 1 || $run->run_status_id == 2) && $input['run_status'] == 3) {
         // get all sample (id and runs remaining) that were included in run have status set
         $samples = DB::table('samples')->select('samples.id', 'runs_remaining')->join('sample_runs', function ($join) {
             $join->on('samples.id', '=', 'sample_runs.sample_id');
         })->join('runs', function ($join) {
             $join->on('runs.id', '=', 'sample_runs.run_id');
         })->where('runs.id', '=', $input['run_id'])->get();
         // increment run by one in database
         foreach ($samples as $sample) {
             DB::table('samples')->where('id', $sample->id)->update(['runs_remaining' => $sample->runs_remaining + 1]);
         }
     }
     // set the run status and update database
     $run->run_status_id = $input['run_status'];
     $run->update();
     return redirect('runs');
 }
コード例 #5
0
 public function store(SampleRunRequest $request)
 {
     $input = $request->all();
     $run = new Run($input);
     $run->users_id = Auth::user()->id;
     $run->run_date = Carbon::now()->addDays($request->get('run_date'));
     $run->created_at = Carbon::now();
     $run->updated_at = Carbon::now();
     $run->save();
     $batch_ids = Session::get('run_batch_ids');
     $batches = Batch::whereIn('id', $batch_ids)->get();
     $errors = $this->validateBatches($batches);
     if (!$errors) {
         $this->runSamples = array();
         foreach ($batches as $batch) {
             foreach ($batch->samples as $sample) {
                 if ($sample->runs_remaining > 0) {
                     $sampleRun = new SampleRun();
                     $sampleRun->created_at = Carbon::now();
                     $sampleRun->updated_at = Carbon::now();
                     $sampleRun->run_id = $run->id;
                     $sampleRun->sample_id = $sample->id;
                     $sampleRun->save();
                     $sample->runs_remaining -= 1;
                     $sample->update();
                     array_push($this->runSamples, $sample);
                 }
             }
         }
     }
     if ($errors) {
         return view('sampleRuns.errors', ['batches' => $batches]);
     }
     $this->exportSheet($run);
     //return redirect('runs');
 }