diff --git a/app/Console/Commands/DbMapper/Helper/FindCompetitionGroupById.php b/app/Console/Commands/DbMapper/Helper/FindCompetitionGroupById.php new file mode 100644 index 00000000..e9f65617 --- /dev/null +++ b/app/Console/Commands/DbMapper/Helper/FindCompetitionGroupById.php @@ -0,0 +1,16 @@ +where('provider_group_id', $mapper['group_id'])->value('competition_group_id'); + } + } +} diff --git a/app/Console/Commands/DbMapper/Helper/FindElementById.php b/app/Console/Commands/DbMapper/Helper/FindElementById.php new file mode 100644 index 00000000..4d9d5ac3 --- /dev/null +++ b/app/Console/Commands/DbMapper/Helper/FindElementById.php @@ -0,0 +1,21 @@ + 0) { + $mapper['txodds_home_id'] = ElementProvider::where('provider_id', $mapper['provider_id']) + ->where('provider_element_id', $mapper['home_id'])->value('element_id'); + } + + if (isset($mapper['away_id']) && $mapper['away_id'] > 0) { + $mapper['txodds_away_id'] = ElementProvider::where('provider_id', $mapper['provider_id']) + ->where('provider_element_id', $mapper['away_id'])->value('element_id'); + } + } +} diff --git a/app/Console/Commands/DbMapper/MaglooKeniaAll.php b/app/Console/Commands/DbMapper/MaglooKeniaAll.php index 71088437..718656d8 100644 --- a/app/Console/Commands/DbMapper/MaglooKeniaAll.php +++ b/app/Console/Commands/DbMapper/MaglooKeniaAll.php @@ -2,14 +2,13 @@ namespace App\Console\Commands\DbMapper; -use App\Console\Commands\DbMapper\Helper\FindCompetitionGroup; -use App\Console\Commands\DbMapper\Helper\FindElement; +use App\Console\Commands\DbMapper\Helper\FindCompetitionGroupById; +use App\Console\Commands\DbMapper\Helper\FindElementById; use App\Console\Commands\DbMapper\Store\StoreElement; use App\Console\Commands\DbMapper\Store\StoreGroup; use App\Console\Commands\Nuh; use App\Models\Event; use App\Models\Mapper; -use App\Models\Sport; use App\Utilities\Notice; use Carbon\Carbon; @@ -28,7 +27,9 @@ class MaglooKeniaAll Notice::note(Nuh::$options['name'], 'g'); } - $sports = Sport::map('magl'); + $sports = [1, 3]; + + $found = []; foreach ($sports as $sport_id) { @@ -36,12 +37,12 @@ class MaglooKeniaAll foreach ($mappers as $mapper) { - FindElement::run($mapper); + FindElementById::run($mapper); - FindCompetitionGroup::run($mapper); + FindCompetitionGroupById::run($mapper); if ($debug) { - Notice::note($mapper, 'b'); + Notice::note($mapper, 'p'); } if ($mapper['txodds_home_id'] && $mapper['txodds_away_id'] && $mapper['txodds_group_id']) { @@ -53,10 +54,19 @@ class MaglooKeniaAll ->where('starttime', '<', $to) ->where('home_id', $mapper['txodds_home_id']) ->where('away_id', $mapper['txodds_away_id']) - ->where('competition_group_id', $mapper['txodds_group_id']) + ->where('group_id', $mapper['txodds_group_id']) ->first(); if ($event) { + + dd($event); + + if (! isset($found[$sport_id])) { + $found[$sport_id] = 1; + } else { + $found[$sport_id]++; + } + StoreElement::store($mapper); StoreGroup::store($mapper); @@ -84,5 +94,9 @@ class MaglooKeniaAll } } } + + if ($debug) { + Notice::note($found, 'g'); + } } }