wip del err
This commit is contained in:
1 parent
812736ca9a
commit
9bcd4432c6
1210 files changed
-220941
No files matched your search
@@ -1,70 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands\Services\Tasks\Alarm;
|
||||
|
||||
use App\Models\EventBookmaker;
|
||||
|
||||
class AlarmStore
|
||||
{
|
||||
public static function get($table, $event_id, $oddnames, $client_bookmaker_id, $alarm_threshold, $compare_odds, $client_odds)
|
||||
{
|
||||
if (! $compare_odds) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (! $client_odds) {
|
||||
return;
|
||||
}
|
||||
|
||||
$favorit = min($client_odds);
|
||||
|
||||
// if ($table == 'odds_points') {
|
||||
// dd($compare_odds);
|
||||
// }
|
||||
|
||||
$update_array = [];
|
||||
foreach ($oddnames as $fieldname => $oddname) {
|
||||
if ($client_odds[$oddname] == $favorit) {
|
||||
|
||||
$threshold = $client_odds[$oddname] - $compare_odds[$oddname];
|
||||
|
||||
if (in_array($table, ['odds_totals', 'odds_totals_ht', 'odds_totals_q1'])) {
|
||||
if ((float) $client_odds['total'] == (float) $compare_odds['total']) {
|
||||
self::setAlarm($update_array, $fieldname, $threshold, $alarm_threshold);
|
||||
} else {
|
||||
$update_array[$fieldname] = 0;
|
||||
}
|
||||
} elseif (in_array($table, ['odds_points', 'odds_points_ht', 'odds_points_q1'])) {
|
||||
if ((float) $client_odds['handicap'] == (float) $compare_odds['handicap']) {
|
||||
self::setAlarm($update_array, $fieldname, $threshold, $alarm_threshold);
|
||||
} else {
|
||||
$update_array[$fieldname] = 0;
|
||||
}
|
||||
} else {
|
||||
self::setAlarm($update_array, $fieldname, $threshold, $alarm_threshold);
|
||||
}
|
||||
} else {
|
||||
$update_array[$fieldname] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
EventBookmaker::where('event_id', $event_id)->where('bookmaker_id', $client_bookmaker_id)->update($update_array);
|
||||
}
|
||||
|
||||
public static function setAlarm(&$update_array, $fieldname, $threshold, $alarm_threshold)
|
||||
{
|
||||
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 {
|
||||
// Reset Alarm
|
||||
$update_array[$fieldname] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user