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

@@ -13,18 +13,23 @@ class _3Way
$odds['h3w'] = (float) $value->o1;
$odds['d3w'] = (float) $value->o2;
$odds['a3w'] = (float) $value->o3;
$odds['a3w'] = (float) 1.1;
}
$odds['margin'] = (float) Margin::calculate([$odds['h3w'], $odds['d3w'], $odds['a3w']], 1);
$res = Odds3way::updateOrCreate(
['event_id' => $odds['event_id'], 'bookmaker_id' => $odds['bookmaker_id']],
$odds,
);
if ($res->wasChanged('h3w', 'd3w', 'h3w')) {
$res = Odds3way::updateOrCreate(
['event_id' => $odds['event_id'], 'bookmaker_id' => $odds['bookmaker_id']],
['oddchange_at' => now()],
);
$res = Odds3way::where('event_id', $odds['event_id'])->where('bookmaker_id', $odds['bookmaker_id'])->first();
if (! $res) {
Odds3way::create($odds);
} else {
$res->h3w = $odds['h3w'];
$res->a3w = $odds['d3w'];
$res->d3w = $odds['a3w'];
if ($res->isDirty()) {
$res->oddchange_at = now();
}
$res->checked_at = $odds['checked_at'];
$res->margin = $odds['margin'];
$res->save();
}
}
}