grapper wip

This commit is contained in:
salam committed 2026-01-18 14:35:30 +01:00
1 parent 562c65f331
commit 4184acdb8a
60 files changed
+28840 -398

No files matched your search

@@ -2,8 +2,8 @@
namespace App\Console\Commands\Grapper\TxOdds\Odds;
use App\Models\OddsDc;
use App\Utilities\Margin;
use Illuminate\Support\Facades\DB;
class _Dc
{
@@ -15,14 +15,21 @@ class _Dc
$odds['dcx2'] = (float) $value->o3;
}
$odds['margin'] = (float) Margin::calculate([$odds['dc1x'], $odds['dc12'], $odds['dcx2']], 1);
$odds['updated_at'] = now();
DB::table('odds_dc')->upsert(
$odds,
['event_id', 'bookmaker_id'],
$res = OddsDc::where('event_id', $odds['event_id'])->where('bookmaker_id', $odds['bookmaker_id'])->first();
['dc1x', 'dc12', 'dcx2', 'margin', 'flags', 'updated_at']
);
if (! $res) {
OddsDc::create($odds);
} else {
$res->dc1x = $odds['dc1x'];
$res->dc12 = $odds['dc12'];
$res->dcx2 = $odds['dcx2'];
if ($res->isDirty()) {
$res->oddchange_at = now();
}
$res->checked_at = $odds['checked_at'];
$res->margin = $odds['margin'];
$res->save();
}
}
}