예제 #1
0
 public function show($referen)
 {
     $empresa = Session::get('empresa');
     Checklist::where('chk_referen', $referen)->delete();
     $documentos = \DB::connection('master')->table('mdb_tipodocum')->select('doc_clave', 'doc_nombre')->get();
     foreach ($documentos as $doc) {
         $result = Result::where('res_referen', $referen)->first();
         if (!empty($result)) {
             $validacion = Validation::where('attribute_id', 9)->where('id', $result->validations_id)->whereRaw('SUBSTRING_INDEX(val_data, "|", 1) = ' . $doc->doc_clave)->count();
             if ($validacion > 0) {
                 $imagen = \DB::connection('users')->table('opauimg')->where('pk_referencia', $referen)->where('imgtipodoc', $doc->doc_clave)->count();
                 if ($imagen > 0) {
                     $check = 1;
                 } else {
                     $check = 0;
                 }
             } else {
                 $check = 2;
             }
         } else {
             $check = 0;
         }
         $data = ["chk_referen" => $referen, "chk_document" => $doc->doc_nombre, "chk_status" => $check, "chk_company" => $empresa];
         Checklist::create($data);
     }
     $result = Checklist::where('chk_company', $empresa)->get();
     return view('list_document')->with(['document' => $result, 'referen' => $referen]);
 }
예제 #2
0
 public function iresponse($project, Request $request)
 {
     $iresponseCol = Question::where('project_id', $project->id)->where('qnum', config('aio.iresponse'))->first();
     $dbraw = DB::select(DB::raw("SELECT pcode.state,answers.*,q.* \n            FROM pcode INNER JOIN results ON results.resultable_id = pcode.primaryid \n            INNER JOIN answers ON answers.status_id = results.id \n            INNER JOIN ( SELECT id,qnum FROM questions where id = '{$iresponseCol->id}') q ON q.id = answers.qid"));
     $dbGroupBy = DB::select(DB::raw("SELECT pcode.state,answers.*,q.* \n            FROM pcode INNER JOIN results ON results.resultable_id = pcode.primaryid \n            INNER JOIN answers ON answers.status_id = results.id \n            INNER JOIN ( SELECT id,qnum FROM questions where id = '{$iresponseCol->id}') q ON q.id = answers.qid GROUP BY results.id"));
     $incidents = Result::where('project_id', $project->id);
     $locations = PLocation::where('org_id', $project->org_id)->groupBy('state');
     return view('frontend.result.response-incident')->withProject($project)->withRequest($request)->withQuestion($iresponseCol)->withIncidents($incidents)->withLocations($locations)->withDbraw(collect($dbraw))->withDbGroup(collect($dbGroupBy));
 }
 /**
  * Display the specified resource.
  *
  * @param  int $id
  * @return Response
  */
 public function show($id)
 {
     $quiz = Quiz::findOrFail($id);
     $result = Result::where('quiz_id', $quiz->id)->first();
     if (!$result) {
         $quiz->status = 'rejected';
         $quiz->save();
         $result = new Result();
         $result->quiz_id = $quiz->id;
         $result->user_id = $quiz->user_id;
         $result->save();
     }
     return view('teacher.results.show')->with('result', $result)->with('title', trans('titles.results'));
 }
예제 #4
0
 public function checkPedimento($referen, $valorOrigen)
 {
     if ($valorOrigen['entrada'] == 1) {
         $pk_referencia = $referen->pk_referencia;
         $tabla = 'optr02';
         $camposel1 = 'pk_factura';
         $camposel2 = 'pk_cove';
         $campow = 'pk_referencia';
     } else {
         $pk_referencia = $referen->folio_ds;
         $tabla = 'ds505';
         $camposel1 = 'NumeroFactura';
         $camposel2 = 'NumeroFactura';
         $campow = 'folio_ds';
     }
     //Recorrer campos del Anexo 22
     $anexo = Anexo22::all();
     foreach ($anexo as $anx) {
         //Checar validaciones por campo
         foreach ($anx->validations as $val) {
             $valid = $val->id;
             $camposbd = $anx->relationships->where('origin_id', $valorOrigen['entrada'])->first();
             $data = ["tabla" => $camposbd->table, "campos" => $camposbd->field, "attr_id" => $val->attribute_id, "data_val" => $val->val_data, "anx_id" => $anx->id, "entrada" => $valorOrigen['entrada'], "referencia" => $pk_referencia];
             $validacion = new Validation();
             $valor = $validacion->isValid($data);
             if ($valor == 0) {
                 if ($val->attribute_id == 9) {
                     $docum = 1;
                 } else {
                     $docum = 0;
                 }
                 $datos = ["res_referen" => $pk_referencia, "validations_id" => $valid, "res_document" => $docum, "res_company" => Session::get('empresa'), "res_user" => Session::get('usuario')];
                 $totalres = Result::where('res_referen', $pk_referencia)->where('validations_id', $valid)->count();
                 if ($totalres == 0) {
                     Result::create($datos);
                 }
             }
         }
     }
     $factura = \DB::connection('users')->table($tabla)->where($campow, $pk_referencia)->first();
     $cove = $this->checkCove($factura, $camposel1, $camposel2, $pk_referencia);
     echo $cove;
 }
예제 #5
0
 public function index($id)
 {
     echo $id;
     $results = Result::where("tournament_id", $id)->get();
     $a = "";
     $results_json = array();
     $i = 0;
     foreach ($results as $result) {
         //   $game["user1"] = $result->user1()->get();
         //  $game["user2"] = $result->user2()->get();
         $game["user1_result"] = array($result->user1()->get()[0]->name, $result->result_user1);
         $game["user2_result"] = array($result->user2()->get()[0]->name, $result->result_user2);
         //   echo $result->user1()->get()[0]->name;
         $results_json[$i] = $game;
         $i++;
     }
     $tournament = Tournament::find($id);
     $data = array('name' => "test", 'age' => "sdfds");
     return view('results.results', array('tournament' => $tournament, 'results' => $results_json));
 }
예제 #6
0
 /**
  * Show the application dashboard to the user.
  *
  * @return Response
  */
 public function index()
 {
     $series = Series::all();
     // get lottery to display
     $time = date("Hi");
     $next_draw_lottery = Lottery::where("draw_time", '>', $time)->orderBy("draw_time")->first();
     if ($next_draw_lottery) {
         $next_draw_time = date_create_from_format("Hi", $next_draw_lottery->draw_time);
         $next_draw_time = $next_draw_time->format("h:i A");
     } else {
         $next_draw_time = "--:--";
     }
     $lottery = Lottery::where("draw_time", '<=', $time)->orderBy("draw_time", "desc")->first();
     if ($lottery) {
         $date = date('Y-m-d');
         $results = Result::where(array("date" => $date, 'lottery_id' => $lottery->id))->with('series')->get();
     }
     // dd($results->first()->series->code);
     return view('home', compact('results', 'lottery', 'series', 'next_draw_time'));
 }
 /**
  * Check that losers score is not higher than the winners score.
  */
 public function moreValidation($validator)
 {
     $match = Result::where('match_id', '=', $this->input('match_id'))->first();
     $booking = Booking::find($this->input('match_id'));
     $validator->after(function ($validator) use($match, $booking) {
         if ($this->input('win')) {
             if ($this->input('user_score') < $this->input('opponent_score')) {
                 $validator->errors()->add('user_score', ' Your score must be higher than your opponent');
             }
         } elseif (!$this->input('result_by_default')) {
             if ($this->input('user_score') > $this->input('opponent_score')) {
                 $validator->errors()->add('user_score', ' Your score must be lower than your opponent');
             }
         }
         if ($match->created_at != $match->created_at) {
             $validator->errors()->add('match_id', 'Match score already entered by opponent');
         }
         if ($booking->booking_date > date('Y-m-d')) {
             $validator->errors()->add('match_id', 'Match has not been played yet');
         }
     });
 }
예제 #8
0
 public function show($testId)
 {
     $results = Result::where('test_id', $testId)->get();
     return $results->toArray();
 }
예제 #9
0
 public function store_winning(Request $request)
 {
     //save winning numbers for $lottery_id for current date
     $input = Input::all();
     $date = date('Y-m-d');
     $lottery_id = (int) $input['lottery_id'];
     // dd(count($results));
     $series = $input['series'];
     // dd($series);
     $ctr = 0;
     foreach ($series as $series_id => $win_no) {
         $series_id = (int) $series_id;
         //check if entry already created for this date and lottery id
         $result = Result::where(array('series_id' => $series_id, 'lottery_id' => $lottery_id, 'date' => $date))->get();
         // dd(count($result));
         if (count($result)) {
             $result = $result[0];
             $result->winning_number = $win_no;
         } else {
             $result = new Result(array('date' => $date, 'lottery_id' => $lottery_id, 'series_id' => $series_id, 'winning_number' => $win_no));
         }
         $rsp = $result->save();
         // $rsp ? ($ctr++) : '';
     }
     return Redirect::to('/admin/lotteries/winning');
 }
 /**
  * Status check function
  * To Do: need to rewrite whole function
  * @param type $project
  * @param type $section
  * @param type $answers
  * @return string
  * @throws GeneralException
  */
 private function updateStatus($project, $section, $answers, $form_id)
 {
     if ($project->type == 'incident') {
         return 'incident';
     }
     $section = (int) $section;
     /**
      * Get total questions count in a section
      */
     $section_qcount = $project->questions->where('section', $section)->count();
     $anscount = count(array_filter(array_keys($answers), 'strlen'));
     // total answers count from form submit
     // initialize error status
     $error = false;
     // flat multi dimentional questions and answers array to single array
     $flat_answers = call_user_func_array('array_merge', $answers);
     /**
      * Loop through form submitted answers
      * $qnum string (question number)
      * $answer array
      */
     foreach ($answers as $qslug => $answer) {
         // get question using qnum slug
         $lftq = $this->questions->getQuestionByQnum($qslug, $section, $project->id);
         /**
          * Loop answer
          * $akey string (radio or answer key)
          * $aval mixed (string or integer submitted by form input)
          */
         foreach ($answer as $akey => $aval) {
             if ($akey == 'radio') {
                 $qanswer = $lftq->qanswers->where('slug', $aval)->first();
             } else {
                 $qanswer = $lftq->qanswers->where('slug', $akey)->first();
             }
             if (!is_null($qanswer)) {
                 if (!empty($qanswer->logic)) {
                     if (!empty($qanswer->logic['lftval'])) {
                         $lftval = $qanswer->logic['lftval'];
                     } else {
                         $lftval = '';
                         switch ($qanswer->type) {
                             case 'radio':
                                 $lftval = $qanswer->value;
                                 break;
                             case 'checkbox':
                                 $lftval = $qanswer->value;
                                 break;
                             default:
                                 if (array_key_exists($qanswer->logic['lftans'], $flat_answers)) {
                                     /** get actual answer if exist in input
                                      *  Ofcourse it will exist because it is left side answer
                                      */
                                     $lftval = $flat_answers[$qanswer->logic['lftans']];
                                 }
                                 break;
                         }
                     }
                     if (!empty($qanswer->logic['rftval'])) {
                         $rftval = $qanswer->logic['rftval'];
                     } else {
                         // initialize right side value
                         $rftval = '';
                         // get right side question
                         if (isset($qanswer->logic['rftquess'])) {
                             $rftq = $this->questions->getQuestionByQnum($qanswer->logic['rftquess'], $section, $project->id);
                             if (!is_null($rftq)) {
                                 if (isset($qanswer->logic['rftans'])) {
                                     $rftanswer = $rftq->qanswers->where('slug', $qanswer->logic['rftans'])->first();
                                     switch ($rftanswer->type) {
                                         case 'radio':
                                             $rftval = $rftanswer->value;
                                             break;
                                         case 'checkbox':
                                             $rftval = $rftanswer->value;
                                             break;
                                         default:
                                             if (array_key_exists($qanswer->logic['rftans'], $flat_answers)) {
                                                 /** get actual answer if exist in input
                                                  */
                                                 $rftval = $flat_answers[$qanswer->logic['rftans']];
                                             } else {
                                                 // get answer from database
                                                 $results = Result::where('project_id', $project->id)->where('incident_id', $form_id)->where('resultable_id', $resultable->id)->where('resultable_type', $resultable_type)->all();
                                                 dd($results);
                                             }
                                             break;
                                     }
                                 }
                             }
                         }
                     }
                     switch ($qanswer->logic['operator']) {
                         case '=':
                             if ($lftval != $rftval) {
                                 $error = true;
                             }
                             break;
                         case '>':
                             if ($lftval < $rftval) {
                                 $error = true;
                             }
                             break;
                         case '<':
                             if ($lftval > $rftval) {
                                 $error = true;
                             }
                             break;
                         case 'between':
                             if ($lftval > $qanswer->logic['minval'] || $lftval < $qanswer->logic['maxval']) {
                                 $error = true;
                             }
                             break;
                         default:
                             $error = false;
                             break;
                     }
                 }
             }
         }
     }
     //dd($ac);
     if ($error === true) {
         return 'error';
     } elseif ($anscount === 0) {
         return 'missing';
     } elseif ($anscount >= $section_qcount) {
         return 'complete';
     } elseif ($anscount < $section_qcount) {
         return 'incomplete';
     } else {
         return 'unknown';
     }
     throw new GeneralException('Something wrong with status checking!');
 }
예제 #11
0
 public function show($testId, RegressionCalculator $regressionCalculator)
 {
     $results = Result::where('test_id', $testId)->latest()->get();
     $regressionLine = $regressionCalculator->calculate($results);
     return view('results.show', compact('results', 'testId', 'regressionLine'));
 }
 protected function insertProjectResult(Request $request, $id)
 {
     $array = Input::all();
     $validator = Validator::make($array, ['content' => 'required']);
     if ($validator->fails()) {
         return Response::json('', 400);
     } else {
         $result = Result::where('Project_FK', '=', $id)->first();
         if (!empty($result)) {
             $result->content = $request->input('content');
             $result->save();
         } else {
             $result = new Result();
             $result->Project_FK = $id;
             $result->content = $request->input('content');
             $result->save();
         }
     }
 }
예제 #13
0
 public function competitor_statistics(Request $request)
 {
     $competitors = Competitor::all();
     //Nevezett versenyzők
     $competitor_in = [];
     foreach ($competitors as $comp) {
         $competitor_in[$comp->id] = $comp->full_name_birthday;
     }
     natsort($competitor_in);
     reset($competitor_in);
     $act_competitor = key($competitor_in);
     //Kiválasztott versenyző
     if ($request->competitor) {
         $act_competitor = $request->competitor;
     }
     $all_result = Result::where('competitor_id', '=', $act_competitor)->orderBy('total_points', 'desc')->get();
     //Úszás és kombinált távok mentése
     $swim_200 = ['Ifi B', 'Ifi A', 'Junior', 'Felnőtt', 'Senior'];
     $swim_100 = ['Ifi C', 'Ifi D'];
     $swim_50 = ['Ifi E', 'Ifi F'];
     $ce_3200 = ['Ifi A', 'Junior', 'Felnőtt', 'Senior'];
     $ce_2400 = ['Ifi B'];
     $ce_1600 = ['Ifi C'];
     $ce_800 = ['Ifi D'];
     $ce_400 = ['Ifi E', 'Ifi F'];
     //Lovaglás legjobb
     $best_riding = Result::where('competitor_id', '=', $act_competitor)->where('riding_points', '!=', 0)->orderBy('riding_points', 'desc')->first();
     //Vívás legjobb
     $best_fencing = Result::where('competitor_id', '=', $act_competitor)->where('fencing_points', '!=', 0)->orderBy('fencing_points', 'desc')->first();
     //Totál legjobb
     $best_total = Result::where('competitor_id', '=', $act_competitor)->where('total_points', '!=', 0)->orderBy('total_points', 'desc')->first();
     //Úszás legjobbak
     $best_swimming_200 = Result::whereIn('age_group', $swim_200)->where('competitor_id', '=', $act_competitor)->where('swimming_time', '!=', '')->orderBy('swimming_time', 'asc')->first();
     $best_swimming_100 = Result::whereIn('age_group', $swim_100)->where('competitor_id', '=', $act_competitor)->where('swimming_time', '!=', '')->orderBy('swimming_time', 'asc')->first();
     $best_swimming_50 = Result::whereIn('age_group', $swim_50)->where('competitor_id', '=', $act_competitor)->where('swimming_time', '!=', '')->orderBy('swimming_time', 'asc')->first();
     //Kombinált legjobbak
     $best_ce_3200 = Result::whereIn('age_group', $ce_3200)->where('competitor_id', '=', $act_competitor)->where('ce_time', '!=', '')->orderBy('ce_time', 'asc')->first();
     $best_ce_2400 = Result::whereIn('age_group', $ce_2400)->where('competitor_id', '=', $act_competitor)->where('ce_time', '!=', '')->orderBy('ce_time', 'asc')->first();
     $best_ce_1600 = Result::whereIn('age_group', $ce_1600)->where('competitor_id', '=', $act_competitor)->where('ce_time', '!=', '')->orderBy('ce_time', 'asc')->first();
     $best_ce_800 = Result::whereIn('age_group', $ce_800)->where('competitor_id', '=', $act_competitor)->where('ce_time', '!=', '')->orderBy('ce_time', 'asc')->first();
     $best_ce_400 = Result::whereIn('age_group', $ce_400)->where('competitor_id', '=', $act_competitor)->where('ce_time', '!=', '')->orderBy('ce_time', 'asc')->first();
     return view('competitor_statistics', compact('all_result', 'competitors', 'competitor_in', 'act_competitor', 'best_riding', 'best_fencing', 'best_total', 'best_swimming_200', 'best_swimming_100', 'best_swimming_50', 'best_ce_3200', 'best_ce_2400', 'best_ce_1600', 'best_ce_800', 'best_ce_400'));
 }
예제 #14
0
 protected function getRequirementSpecificationPercent($id)
 {
     $counter = 0;
     $introduction = ProjectIntroduction::where('Project_FK', '=', $id)->first();
     if (count($introduction) > 0) {
         $counter++;
     }
     $non = NonFunctionalRequirement::where('Project_FK', '=', $id)->first();
     if (count($non) > 0) {
         $counter++;
     }
     $quality = ProjectQuality::where('Project_FK', '=', $id)->first();
     if (count($quality) > 0) {
         $counter++;
     }
     $need = NeedToHave::where('Project_FK', '=', $id)->first();
     if (count($need) > 0) {
         $counter++;
     }
     $nice = NiceToHave::where('Project_FK', '=', $id)->first();
     if (count($nice) > 0) {
         $counter++;
     }
     $result = Result::where('Project_FK', '=', $id)->first();
     if (count($result) > 0) {
         $counter++;
     }
     $use = ProjectUse::where('Project_FK', '=', $id)->first();
     if (count($use) > 0) {
         $counter++;
     }
     $actual = ActualState::where('Project_FK', '=', $id)->first();
     if (count($actual) > 0) {
         $counter++;
     }
     $target = TargetState::where('Project_FK', '=', $id)->first();
     if (count($target) > 0) {
         $counter++;
     }
     $data = ProductData::where('Project_FK', '=', $id)->first();
     if (count($data) > 0) {
         $counter++;
     }
     return $counter;
 }
예제 #15
0
 /** Главный метод: гененрирует полотно вопросов на странице тестов */
 public function showViews($id_test)
 {
     $test = new Test();
     $result = new Result();
     $user = new User();
     $widgets = [];
     $saved_test = [];
     $current_date = date('U');
     $query = $test->whereId_test($id_test)->select('amount', 'test_name', 'test_time', 'start', 'end', 'test_type')->first();
     if ($current_date < strtotime($query->start) || $current_date > strtotime($query->end)) {
         //проверка открыт ли тест
         return view('no_access');
     }
     $amount = $query->amount;
     //кол-во вопрососв в тесте
     $result->test_name = $query->test_name;
     $test_time = $query->test_time;
     $test_type = $query->test_type;
     if (!Session::has('test')) {
         //если в тест зайдено первый раз
         $test = new Test();
         $test_controller = new TestController($test);
         $ser_array = $this->prepareTest($id_test);
         for ($i = 0; $i < $amount; $i++) {
             $id = $this->chooseQuestion($ser_array);
             if (!$test_controller->rybaTest($id)) {
                 //проверка на вопрос по рыбе
                 return view('no_access');
             }
             $data = $this->showTest($id, $i + 1);
             //должны получать название view и необходимые параметры
             $saved_test[] = $data;
             $widgets[] = View::make($data['view'], $data['arguments']);
         }
         $start_time = date_create();
         //время начала
         $int_end_time = date_format($start_time, 'U') + 60 * $test_time;
         //время конца
         Session::put('end_time', $int_end_time);
         $query = Result::max('id_result');
         //пример использования агрегатных функций!!!
         $current_result = $query + 1;
         //создаем строку в таблице пройденных тестов
         $query2 = $user->whereEmail(Auth::user()['email'])->select('id')->first();
         $result->id_result = $current_result;
         $result->id_user = $query2->id;
         $result->id_test = $id_test;
         $result->amount = $amount;
         $result->save();
         $saved_test = serialize($saved_test);
         Result::where('id_result', '=', $current_result)->update(['saved_test' => $saved_test]);
         Session::put('test', $current_result);
     } else {
         //если была перезагружена страница теста или тест был покинут
         $current_test = Session::get('test');
         $query = $result->whereId_result($current_test)->first();
         $int_end_time = Session::get('end_time');
         //время окончания теста
         $saved_test = $query->saved_test;
         $saved_test = unserialize($saved_test);
         for ($i = 0; $i < $amount; $i++) {
             $widgets[] = View::make($saved_test[$i]['view'], $saved_test[$i]['arguments']);
         }
     }
     $current_time = date_create();
     //текущее время
     $int_left_time = $int_end_time - date_format($current_time, 'U');
     //оставшееся время
     $left_min = floor($int_left_time / 60);
     //осталось минут
     $left_sec = $int_left_time % 60;
     //осталось секунд
     $widgetListView = View::make('questions.student.widget_list', compact('amount', 'id_test', 'left_min', 'left_sec', 'test_type'))->with('widgets', $widgets);
     $response = new Response($widgetListView);
     return $response;
 }
 public function dsq_save($id, Request $request)
 {
     $competitiongroup = Competitiongroup::whereId($id)->firstOrFail();
     $act_competitor = $request->act_comp;
     $result = Result::where('competitiongroup_id', '=', $id)->where('competitor_id', '=', $act_competitor)->first();
     $result->dsq_status = 1;
     $result->fencing_win = null;
     $result->fencing_lose = null;
     $result->fencing_points = 0;
     $result->penalty_points_fencing = null;
     $result->fencing_order = 0;
     $result->swimming_time = "";
     $result->swimming_points = 0;
     $result->penalty_points_swimming = null;
     $result->swimming_order = 0;
     $result->riding_point = "";
     $result->riding_time = "";
     $result->riding_points = 0;
     $result->horse_id = null;
     $result->riding_order = 0;
     $result->ce_time = "";
     $result->ce_points = 0;
     $result->penalty_points_ce = null;
     $result->ce_order = 0;
     $result->total_points = 0;
     $result->total_penalty_points = null;
     $result->save();
     if ($competitiongroup->fencing_bouts != 0) {
         $competitiongroup->fencing_bouts = $competitiongroup->fencing_bouts - $competitiongroup->bouts_per_match;
         $competitiongroup->save();
     }
     $fencing_results1 = Fencing_result::where('competitiongroup_id', '=', $id)->where('competitor1_id', '=', $act_competitor)->get();
     $fencing_results2 = Fencing_result::where('competitiongroup_id', '=', $id)->where('competitor2_id', '=', $act_competitor)->get();
     foreach ($fencing_results1 as $fence) {
         $fence->delete();
     }
     foreach ($fencing_results2 as $fence) {
         $fence->delete();
     }
     //Sorrendek
     $this->riding_order($id);
     $this->swimming_order($id);
     $this->ce_order($id);
     $this->total_fencing_points($id);
     $this->total_points($id);
     $this->team_points_order($id);
     return redirect('admin/competitiongroups/' . $id . '/dsq')->with('status', 'Versenyző kizárva.');
 }
예제 #17
0
 public function getStatusCount($project, Request $request)
 {
     //$section = $request->get('section');
     $location = $request->get('location');
     $loctype = $request->get('loctype');
     foreach ($project->sections as $section => $section_value) {
         if ($loctype && $location) {
             $total_forms = PLocation::where('org_id', $project->org_id)->where($loctype, $location)->count();
             //dd($total_forms);
             $total_results = Result::where('project_id', $project->id)->where('section_id', $section)->OfWithPcode($loctype, $location)->count();
             $result['complete'][$section]['y'] = Result::where('project_id', $project->id)->where('section_id', $section)->where('information', 'complete')->OfWithPcode($loctype, $location)->count();
             $result['incomplete'][$section]['y'] = Result::where('project_id', $project->id)->where('section_id', $section)->where('information', 'incomplete')->OfWithPcode($loctype, $location)->count();
             $result['error'][$section]['y'] = Result::where('project_id', $project->id)->where('section_id', $section)->where('information', 'error')->OfWithPcode($loctype, $location)->count();
             $result['missing'][$section]['y'] = $total_forms - $total_results;
             $result['complete'][$section]['label'] = $section_value->text;
             $result['incomplete'][$section]['label'] = $section_value->text;
             $result['error'][$section]['label'] = $section_value->text;
             $result['missing'][$section]['label'] = $section_value->text;
         } else {
             $total_forms = PLocation::where('org_id', $project->org_id)->count();
             $total_results = Result::where('project_id', $project->id)->where('section_id', $section)->count();
             $result['complete'][$section]['y'] = Result::where('project_id', $project->id)->where('section_id', $section)->where('information', 'complete')->count();
             $result['incomplete'][$section]['y'] = Result::where('project_id', $project->id)->where('section_id', $section)->where('information', 'incomplete')->count();
             $result['error'][$section]['y'] = Result::where('project_id', $project->id)->where('section_id', $section)->where('information', 'error')->count();
             $result['missing'][$section]['y'] = $total_forms - $total_results;
             $result['complete'][$section]['label'] = _t($section_value->text);
             $result['incomplete'][$section]['label'] = _t($section_value->text);
             $result['error'][$section]['label'] = _t($section_value->text);
             $result['missing'][$section]['label'] = _t($section_value->text);
             //$result['complete'][$section]['indexLabel'] = _t($section_value->text);
             //$result['incomplete'][$section]['indexLabel'] = _t($section_value->text);
             //$result['error'][$section]['indexLabel'] = _t($section_value->text);
             //$result['missing'][$section]['indexLabel'] = _t($section_value->text);
             //$result['complete'][$section]['indexLabelPlacement'] = 'inside';
             //$result['incomplete'][$section]['indexLabelPlacement'] = 'inside';
             //$result['error'][$section]['indexLabelPlacement'] = 'inside';
             //$result['missing'][$section]['indexLabelPlacement'] = 'inside';
         }
     }
     //$result = Result::where('section_id', $section)->where('information', $status)->OfWithPcode('state','Yangon')->count();
     return response()->json($result);
 }
 /**
  * @param $input
  * @param $result
  * @throws GeneralException
  */
 private function checkResultByEmail($input, $result)
 {
     //Figure out if email is not the same
     if ($result->email != $input['email']) {
         //Check to see if email exists
         if (Result::where('email', '=', $input['email'])->first()) {
             throw new GeneralException('That email address belongs to a different result.');
         }
     }
 }
예제 #19
0
 private function calculate_result($u_input)
 {
     $opponent_result = Result::where('match_id', '=', $u_input->input('match_id'))->where('player_id', '!=', \Auth::user()->id);
     $user_result = Result::where('match_id', '=', $u_input->input('match_id'))->where('player_id', '=', \Auth::user()->id);
     if ($u_input->input('win')) {
         $winner_points = $this->winners_result($u_input->input('result_by_default'), $u_input->input('user_score'), $u_input->input('opponent_score'));
         $loser_points = $this->losers_result($u_input->input('result_by_default'), $u_input->input('opponent_score'));
         $user_result->update(['points' => $winner_points, 'winner' => '1']);
         $opponent_result->update(['points' => $loser_points, 'winner' => '0']);
         return;
     }
     $winner_points = $this->winners_result($u_input->input('result_by_default'), $u_input->input('opponent_score'), $u_input->input('user_score'));
     $loser_points = $this->losers_result($u_input->input('result_by_default'), $u_input->input('user_score'));
     $user_result->update(['points' => $loser_points, 'winner' => '0']);
     $opponent_result->update(['points' => $winner_points, 'winner' => '1']);
     return;
 }
 public function teams_entry($id)
 {
     $competitiongroup = Competitiongroup::whereId($id)->firstOrFail();
     //Versenyzők a listába
     $result_list = Result::where('competitiongroup_id', '=', $id)->get()->lists('competitor_id', 'competitor_id');
     $already_in1 = Results_team::select('competitor1_id')->where('competitiongroup_id', '=', $id)->get()->lists('competitor1_id', 'competitor1_id');
     $already_in2 = Results_team::select('competitor2_id')->where('competitiongroup_id', '=', $id)->get()->lists('competitor2_id', 'competitor2_id');
     $already_in3 = Results_team::select('competitor3_id')->where('competitiongroup_id', '=', $id)->get()->lists('competitor3_id', 'competitor3_id');
     foreach ($already_in1 as $remove) {
         $result_list->forget($remove);
     }
     foreach ($already_in2 as $remove) {
         $result_list->forget($remove);
     }
     foreach ($already_in3 as $remove) {
         $result_list->forget($remove);
     }
     $competitors = [];
     foreach ($result_list as $comp) {
         $temp_comp = Competitor::whereId($comp)->first();
         $competitors[$comp] = $temp_comp->full_name_birthday;
     }
     natsort($competitors);
     //Benevezett versenyzők
     $competitor_list = Result::select('results.*')->where('competitiongroup_id', '=', $id)->join('competitors', 'results.competitor_id', '=', 'competitors.id')->orderBy('full_name', 'asc')->get();
     $competitor_in = [];
     foreach ($competitor_list as $comp) {
         $competitor_in[$comp->id] = $comp->competitor->full_name;
     }
     natsort($competitor_in);
     $comp_count = count($competitor_in);
     //Benevezett csapatok
     $team_list = Results_team::where('competitiongroup_id', '=', $id)->orderBy('name')->get();
     $team_in = [];
     foreach ($team_list as $team) {
         $team_in[$team->id] = $team->name;
     }
     natsort($team_in);
     $team_count = count($team_in);
     return view('backend.competitiongroups.teams_entry', compact('competitiongroup', 'competitors', 'team_in', 'team_list', 'team_count', 'competitor_in', 'competitor_list', 'comp_count'));
 }