예제 #1
0
 public function EV3()
 {
     $faker = Faker::create();
     $data = CombatRound::where('challenge_id', '=', 1)->get();
     foreach ($data as $d) {
         $score1 = $faker->numberBetween($min = 2, $max = 3);
         $score2 = $faker->numberBetween($min = 2, $max = 3);
         if ($score1 == 3 && $score2 == 3) {
             $score1 = $score1 - 1;
         }
         if ($score1 == 2 && $score2 == 2) {
             $score2 = $score2 + 1;
         }
         if ($score1 > $score2) {
             $win = $d['versus_one'];
         } else {
             if ($score2 > $score1) {
                 $win = $d['versus_two'];
             }
         }
         Sumo::create(['combat_id' => $d['id'], 'team_id_win' => $win, 'team_id_one' => $d['versus_one'], 'scort_team_one' => $score1, 'firm_team_one' => $faker->numberBetween($min = 1, $max = count(User::get())), 'team_id_two' => $d['versus_two'], 'scort_team_two' => $score2, 'firm_team_two' => $faker->numberBetween($min = 1, $max = count(User::get()))]);
     }
 }
예제 #2
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $faker = Faker::create();
     //$faker->addProvider(new Faker\Provider\DateTime($faker));
     $data = CombatRound::where('challenge_id', '=', 5)->get();
     foreach ($data as $d) {
         $time1 = DateTime::time($format = 'H:i:s', $max = '00:02:00');
         $time2 = DateTime::time($format = 'H:i:s', $max = '00:02:00');
         $zonaRoja1 = $faker->numberBetween($min = 2, $max = 5);
         $nZonaRojo1 = $zonaRoja1 + 1;
         $zonaVerde1 = $faker->numberBetween($min = 1, $max = 5);
         $nZonaVerde1 = $zonaVerde1 + 1;
         $zonaAzul1 = $faker->numberBetween($min = 2, $max = 5);
         $nZonaAzul1 = $zonaAzul1 + 1;
         $zonaRoja2 = $faker->numberBetween($min = 2, $max = 5);
         $nZonaRojo2 = $zonaRoja2 + 1;
         $zonaVerde2 = $faker->numberBetween($min = 1, $max = 5);
         $nZonaVerde2 = $zonaVerde2 + 1;
         $zonaAzul2 = $faker->numberBetween($min = 2, $max = 5);
         $nZonaAzul2 = $zonaAzul2 + 1;
         BlockRise::create(['combat_id' => $d['id'], 'team_id_1' => $d['versus_one'], 'time_team_1' => $time1, 'zon_pun_roj_1' => $zonaRoja1, 'num_api_roj_1' => $nZonaRojo1, 'zon_pun_ver_1' => $zonaVerde1, 'num_api_ver_1' => $nZonaVerde1, 'zon_pun_azu_1' => $zonaAzul1, 'num_api_azu_1' => $nZonaAzul1, 'team_id_2' => $d['versus_two'], 'time_team_2' => $time2, 'zon_pun_roj_2' => $zonaRoja2, 'num_api_roj_2' => $nZonaRojo2, 'zon_pun_ver_2' => $zonaVerde2, 'num_api_ver_2' => $nZonaVerde2, 'zon_pun_azu_2' => $zonaAzul2, 'num_api_azu_2' => $nZonaAzul2]);
     }
 }
 public function getInformationCombat($id)
 {
     return CombatRound::where('rb_combat_round.id', '=', $id)->join('rb_group_stage as r_g', 'r_g.round_id', '=', 'rb_combat_round.versus_one')->join('rb_group_stage as r_g2', 'r_g2.round_id', '=', 'rb_combat_round.versus_two')->join('rb_rounds as r_b', 'r_b.id', '=', 'r_g.round_id')->join('rb_rounds as r_b2', 'r_b2.id', '=', 'r_g2.round_id')->join('rb_team as r_t', 'r_t.id', '=', 'r_b.team_id')->join('rb_team as r_t2', 'r_t2.id', '=', 'r_b2.team_id')->join('rb_groups as r_gr', 'r_gr.id', '=', 'r_g.group_id')->join('rb_groups as r_gr2', 'r_gr2.id', '=', 'r_g2.group_id')->join('rb_institution as r_i', 'r_i.id', '=', 'r_t.institution_id')->join('rb_institution as r_i2', 'r_i2.id', '=', 'r_t2.institution_id')->join('rb_challenges as r_c', 'r_c.id', '=', 'r_t.challenge_id')->select('r_b.team_id as r_b_team_id', 'r_b2.team_id as r_b2_team_id', 'r_t.name as r_t_name', 'r_t2.name as r_t2_name', 'r_t.gender as gender_1', 'r_t2.gender as gender_2', 'r_i.name as in_name_1', 'r_i2.name as in_name_2', 'r_c.name as nam_c', 'r_c.duration as duration', 'r_c.challenge_duration as challenge_duration', 'rb_combat_round.completed as completed', 'rb_combat_round.evaluation as evaluation')->orderBy('rb_combat_round.schedule_start', 'asc')->first();
 }
예제 #4
0
 public function getRefStage(Request $request)
 {
     return $combat = CombatRound::where('rb_combat_round.stage_id', '=', $request->id)->join('rb_group_stage as r_g', 'r_g.round_id', '=', 'rb_combat_round.versus_one')->join('rb_group_stage as r_g2', 'r_g2.round_id', '=', 'rb_combat_round.versus_two')->join('rb_rounds as r_b', 'r_b.id', '=', 'r_g.round_id')->join('rb_rounds as r_b2', 'r_b2.id', '=', 'r_g2.round_id')->join('rb_team as r_t', 'r_t.id', '=', 'r_b.team_id')->join('rb_team as r_t2', 'r_t2.id', '=', 'r_b2.team_id')->join('rb_groups as r_gr', 'r_gr.id', '=', 'r_g.group_id')->join('rb_groups as r_gr2', 'r_gr2.id', '=', 'r_g2.group_id')->select('r_g.id as id_rg', 'r_g.group_id as group_id_rg', 'r_g2.id as id_rg2', 'r_g2.group_id as group_id_rg2', 'r_b.team_id as r_b_team_id', 'r_b2.team_id as r_b2_team_id', 'r_gr.name as r_gr_name', 'r_gr2.name as r_gr2_name', 'r_t.name as r_t_name', 'r_t2.name as r_t2_name', 'rb_combat_round.*')->orderBy('schedule_start', 'ASC')->get()->toArray();
 }
예제 #5
0
 public static function FindCombat($id)
 {
     $data = Con::pagination($id);
     $challenge = Challenge::find($id);
     $challenge_name = $challenge->name;
     foreach ($data as $d) {
         $data = Groupsta::where('group_id', '=', $d['id'])->select('round_id')->get()->toArray();
         $arrayBuild = CombatRoundController::buildArray($data);
         $valore = CombatRoundController::funPru($arrayBuild);
         $dataGroup = Group::find($d['id']);
         foreach ($valore as $val) {
             $dat = CombatRound::where('group_id', '=', $d['id'])->where('versus_one', '=', $val['0'])->where('versus_two', '=', $val['1'])->where('challenge_id', '=', $id)->get();
             if (count($dat) <= 0) {
                 CombatRound::create(['group_id' => $d['id'], 'stage_id' => $dataGroup->stage_id, 'versus_one' => $val['0'], 'versus_two' => $val['1'], 'challenge_id' => $d['challenge_id']]);
             }
         }
     }
     $data = CombatRoundController::getRoundInfo($id);
     dd($data);
     if (!ENV('DEVELOP')) {
         return view('combatround.index', compact('data', 'challenge_name'));
     }
 }