This commit is contained in:
salam committed 2026-01-26 18:26:02 +01:00
1 parent 9ca5657827
commit 6f3d608704
47 files changed
+1005 -145

No files matched your search

@@ -0,0 +1,42 @@
<?php
namespace App\Console\Commands\Services\Tasks\Alarm;
use App\Models\EventBookmaker;
class AlarmStore
{
public static function get($event_id, $table, $client_bookmaker_id, $alarm_threshold, $compare_odds, $client_odds)
{
$oddnames = AlarmMap::get($table);
if (! $compare_odds) {
return;
}
if (! $client_odds) {
return;
}
$update_array = [];
foreach ($oddnames as $fieldname => $oddname) {
$threshold = $client_odds[$oddname] - $compare_odds[$oddname];
if ($threshold > $alarm_threshold[3]) {
// ROT
$update_array[$fieldname] = 3;
} elseif ($threshold > $alarm_threshold[2]) {
// ORANGE
$update_array[$fieldname] = 2;
} elseif ($threshold > $alarm_threshold[1]) {
// GRÜNE
$update_array[$fieldname] = 1;
} else {
// Rset Alarm
$update_array[$fieldname] = 0;
}
}
EventBookmaker::where('event_id', $event_id)->where('bookmaker_id', $client_bookmaker_id)->update($update_array);
}
}