@@ -28,9 +28,9 @@ |
||
| 28 | 28 | $this->publishes([__DIR__ . '/../database/migrations' => $this->app->databasePath() . '/migrations'], 'migrations'); |
| 29 | 29 | $this->publishes([__DIR__ . '/../database/seeds' => $this->app->databasePath() . '/seeds'], 'seeds'); |
| 30 | 30 | $this->publishes([__DIR__ . '/../database/factories' => $this->app->databasePath() . '/factories'], 'seeds'); |
| 31 | - $this->publishes([__DIR__ . '/../resources/assets' => public_path('vendor/kendo-tournaments'),], 'assets'); |
|
| 31 | + $this->publishes([__DIR__ . '/../resources/assets' => public_path('vendor/kendo-tournaments'), ], 'assets'); |
|
| 32 | 32 | |
| 33 | - $router->group(['prefix' => 'kendo-tournaments', 'middleware' => ['web']], function ($router) { |
|
| 33 | + $router->group(['prefix' => 'kendo-tournaments', 'middleware' => ['web']], function($router) { |
|
| 34 | 34 | $router->get('/', 'Xoco70\KendoTournaments\TreeController@index')->name('tree.index'); |
| 35 | 35 | $router->post('/championships/{championship}/trees', 'Xoco70\KendoTournaments\TreeController@store')->name('tree.index'); |
| 36 | 36 | }); |
@@ -4,9 +4,7 @@ |
||
| 4 | 4 | namespace Xoco70\KendoTournaments\Models; |
| 5 | 5 | |
| 6 | 6 | |
| 7 | -use App\User; |
|
| 8 | 7 | use Illuminate\Database\Eloquent\Model; |
| 9 | -use Illuminate\Support\Collection; |
|
| 10 | 8 | |
| 11 | 9 | class Fight extends Model |
| 12 | 10 | { |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | |
| 89 | 89 | /** |
| 90 | 90 | * Save a Fight. |
| 91 | - * @param $rounds |
|
| 91 | + * @param Collection $rounds |
|
| 92 | 92 | * @param int $numRound |
| 93 | 93 | */ |
| 94 | 94 | public static function savePreliminaryFightRound($rounds, $numRound = 1) |
@@ -156,6 +156,9 @@ discard block |
||
| 156 | 156 | // } |
| 157 | 157 | // } |
| 158 | 158 | |
| 159 | + /** |
|
| 160 | + * @param Collection $rounds |
|
| 161 | + */ |
|
| 159 | 162 | public static function saveRoundRobinFights(Championship $championship, $rounds) |
| 160 | 163 | { |
| 161 | 164 | |
@@ -103,9 +103,9 @@ discard block |
||
| 103 | 103 | $fighter2 = isset($round->teams[1]) ? $round->teams[1] : null; |
| 104 | 104 | $fighter3 = isset($round->teams[2]) ? $round->teams[2] : null; |
| 105 | 105 | } else { |
| 106 | - $fighter1 = isset($round->competitors[0]) ? $round->competitors[0] : null; |
|
| 107 | - $fighter2 = isset($round->competitors[1]) ? $round->competitors[1] : null; |
|
| 108 | - $fighter3 = isset($round->competitors[2]) ? $round->competitors[2] : null; |
|
| 106 | + $fighter1 = isset($round->competitors[0]) ? $round->competitors[0] : null; |
|
| 107 | + $fighter2 = isset($round->competitors[1]) ? $round->competitors[1] : null; |
|
| 108 | + $fighter3 = isset($round->competitors[2]) ? $round->competitors[2] : null; |
|
| 109 | 109 | } |
| 110 | 110 | switch ($numRound) { |
| 111 | 111 | case 1: |
@@ -164,7 +164,7 @@ discard block |
||
| 164 | 164 | |
| 165 | 165 | $fighters = self::getActorsToFights($championship, $round2); |
| 166 | 166 | |
| 167 | - $away = $fighters->splice(sizeof($fighters) / 2); // 2 |
|
| 167 | + $away = $fighters->splice(sizeof($fighters) / 2); // 2 |
|
| 168 | 168 | |
| 169 | 169 | $home = $fighters; // 1 |
| 170 | 170 | |
@@ -62,7 +62,7 @@ |
||
| 62 | 62 | |
| 63 | 63 | /** |
| 64 | 64 | * @param Collection $rounds |
| 65 | - * @param $settings |
|
| 65 | + * @param ChampionshipSettings $settings |
|
| 66 | 66 | * @param Championship $championship |
| 67 | 67 | */ |
| 68 | 68 | public static function generateFights(Collection $rounds, $settings, Championship $championship = null) |
@@ -70,7 +70,7 @@ |
||
| 70 | 70 | |
| 71 | 71 | // Delete previous fight for this championship |
| 72 | 72 | |
| 73 | - $arrRoundsId = $rounds->map(function ($value, $key) { |
|
| 73 | + $arrRoundsId = $rounds->map(function($value, $key) { |
|
| 74 | 74 | return $value->id; |
| 75 | 75 | })->toArray(); |
| 76 | 76 | Fight::destroy($arrRoundsId); |
@@ -19,6 +19,9 @@ discard block |
||
| 19 | 19 | public $championship, $settings; |
| 20 | 20 | |
| 21 | 21 | |
| 22 | + /** |
|
| 23 | + * @param \Xoco70\KendoTournaments\Models\ChampionshipSettings $settings |
|
| 24 | + */ |
|
| 22 | 25 | public function __construct(Championship $championship, $groupBy, $settings) |
| 23 | 26 | { |
| 24 | 27 | $this->championship = $championship; |
@@ -242,7 +245,7 @@ discard block |
||
| 242 | 245 | |
| 243 | 246 | /** |
| 244 | 247 | * @param $fighterGroups |
| 245 | - * @param $max |
|
| 248 | + * @param integer $max |
|
| 246 | 249 | * @return Collection |
| 247 | 250 | */ |
| 248 | 251 | private function repart($fighterGroups, $max) |
@@ -196,7 +196,7 @@ |
||
| 196 | 196 | private function getTreeSize($fighterCount, $groupSize) |
| 197 | 197 | { |
| 198 | 198 | $square = collect([1, 2, 4, 8, 16, 32, 64]); |
| 199 | - $squareMultiplied = $square->map(function ($item, $key) use ($groupSize) { |
|
| 199 | + $squareMultiplied = $square->map(function($item, $key) use ($groupSize) { |
|
| 200 | 200 | return $item * $groupSize; |
| 201 | 201 | }); |
| 202 | 202 | |
@@ -13,7 +13,7 @@ |
||
| 13 | 13 | */ |
| 14 | 14 | public function up() |
| 15 | 15 | { |
| 16 | - Schema::create('round_competitor', function (Blueprint $table) { |
|
| 16 | + Schema::create('round_competitor', function(Blueprint $table) { |
|
| 17 | 17 | $table->increments('id'); |
| 18 | 18 | $table->integer('competitor_id')->unsigned()->nullable()->index(); |
| 19 | 19 | $table->integer('round_id')->unsigned()->index(); // A checar |
@@ -13,7 +13,7 @@ |
||
| 13 | 13 | */ |
| 14 | 14 | public function up() |
| 15 | 15 | { |
| 16 | - Schema::create('round_team', function (Blueprint $table) { |
|
| 16 | + Schema::create('round_team', function(Blueprint $table) { |
|
| 17 | 17 | $table->increments('id'); |
| 18 | 18 | $table->integer('team_id')->unsigned()->nullable()->index(); |
| 19 | 19 | $table->integer('round_id')->unsigned()->index(); // A checar |
@@ -31,7 +31,7 @@ |
||
| 31 | 31 | |
| 32 | 32 | public function rounds() |
| 33 | 33 | { |
| 34 | - return $this->belongsToMany(Round::class,'round_team'); |
|
| 34 | + return $this->belongsToMany(Round::class, 'round_team'); |
|
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | } |
| 38 | 38 | \ No newline at end of file |
@@ -76,7 +76,7 @@ |
||
| 76 | 76 | |
| 77 | 77 | public function rounds() |
| 78 | 78 | { |
| 79 | - return $this->belongsToMany(Round::class,'round_competitor'); |
|
| 79 | + return $this->belongsToMany(Round::class, 'round_competitor'); |
|
| 80 | 80 | } |
| 81 | 81 | |
| 82 | 82 | } |
@@ -10,11 +10,9 @@ |
||
| 10 | 10 | use Xoco70\KendoTournaments\Models\Championship; |
| 11 | 11 | use Xoco70\KendoTournaments\Models\ChampionshipSettings; |
| 12 | 12 | use Xoco70\KendoTournaments\Models\Competitor; |
| 13 | -use Xoco70\KendoTournaments\Models\Fight; |
|
| 14 | 13 | use Xoco70\KendoTournaments\Models\Tournament; |
| 15 | 14 | use Xoco70\KendoTournaments\Models\Round; |
| 16 | 15 | use Xoco70\KendoTournaments\TreeGen\TreeGen; |
| 17 | -use Faker\Factory as Faker; |
|
| 18 | 16 | |
| 19 | 17 | class TreeController extends Controller |
| 20 | 18 | { |