fix LoadPartnerDifferences

This commit is contained in:
salam committed 2026-02-08 15:25:04 +01:00
1 parent fbacfdde20
commit 501511de17
6 files changed
+37 -32

No files matched your search

@@ -14,6 +14,7 @@ class ListEvents extends ListRecords
protected string|Width|null $maxContentWidth = Width::Full;
protected $listeners = [
'refreshTable' => '$refresh',
'filterClearFilter' => 'clearFilters',
'filterUpdateGreen' => 'updateTableFiltersGreen',
'filterUpdateYellow' => 'updateTableFiltersYellow',
@@ -63,11 +63,11 @@ class EventsTable
return $table
->striped()
->poll('10s')
// ->poll('10s')
->deferLoading()
->defaultPaginationPageOption(5)
->defaultPaginationPageOption(4)
->extremePaginationLinks()
->paginated([5, 10, 15])
->paginated([4, 10, 15])
->columns([
IconColumn::make('sport.icon')
->label('')
@@ -10,45 +10,36 @@ class LoadPartnerDifferences
{
public static function load()
{
$fields = OddsTable::fields();
$event_ids = [];
foreach (EventsTable::$bettype_settings as $table) {
$has_active_spread = OddsTable::where('name', $table)->value('has_active_spread');
if ($has_active_spread) {
$books = DB::table($table)
->where('bookmaker_id', auth()->user()->bookmaker_id)
->where('active_spread', 1)
->get();
$partners = DB::table($table)
->where('bookmaker_id', auth()->user()->partner_bookmaker_id)
$events = DB::table($table)
->whereIn('bookmaker_id', [auth()->user()->bookmaker_id, auth()->user()->partner_bookmaker_id])
->where('active_spread', 1)
->get();
} else {
$books = DB::table($table)
->where('bookmaker_id', auth()->user()->bookmaker_id)
->get();
$partners = DB::table($table)
->where('bookmaker_id', auth()->user()->partner_bookmaker_id)
$events = DB::table($table)
->whereIn('bookmaker_id', [auth()->user()->bookmaker_id, auth()->user()->partner_bookmaker_id])
->get();
}
$res = [];
foreach ($events as $value) {
$value = get_object_vars($value);
$event_id = $value['event_id'];
foreach (['id', 'event_id', 'sport_id', 'bookmaker_id', 'provider_id', 'offer_id', 'bmoid', 'margin', 'flags', 'nuh_check', 'last_updated', 'created_at', 'updated_at'] as $fieldname) {
unset($value[$fieldname]);
}
$res[$event_id][] = $value;
}
foreach ($books as $book) {
$row1 = get_object_vars($book);
foreach ($partners as $partner) {
$row2 = get_object_vars($partner);
if ($row1['event_id'] == $row2['event_id']) {
foreach ($fields[$table] as $field) {
if ($row1[$field] != $row2[$field]) {
$event_ids[] = $row1['event_id'];
}
}
}
foreach ($res as $event_id => $odds) {
if (count($odds) == 2 && array_diff($odds[0], $odds[1])) {
$event_ids[] = $event_id;
}
}
}
return array_unique($event_ids);
@@ -21,9 +21,9 @@ class AlarmWidget extends StatsOverviewWidget
protected function getStats(): array
{
if (auth()->user()->partner_show) {
return [];
}
// if (auth()->user()->partner_show) {
// return [];
// }
$res = AlarmStatistic::load();
+10
View File
@@ -88,6 +88,9 @@ class BettypeToggle extends Component
User::where('id', auth()->user()->id)->update(['partner_compare' => 0, 'partner_show' => DB::raw('!partner_show')]);
$this->dispatch('refreshBettypeMenu');
$this->dispatch('refreshTable');
}
public function toggleComparePartner()
@@ -95,6 +98,8 @@ class BettypeToggle extends Component
User::where('id', auth()->user()->id)->update(['partner_compare' => DB::raw('!partner_compare')]);
$this->dispatch('refreshBettypeMenu');
$this->dispatch('refreshTable');
}
public function toggleMultiline()
@@ -102,6 +107,8 @@ class BettypeToggle extends Component
User::where('id', auth()->user()->id)->update(['is_multiline_direct' => DB::raw('!is_multiline_direct')]);
$this->dispatch('refreshBettypeMenu');
$this->dispatch('refreshTable');
}
/*
@@ -142,6 +149,8 @@ class BettypeToggle extends Component
User::where('id', auth()->user()->id)->update(['all_only_none' => $value]);
$this->dispatch('refreshBettypeMenu');
$this->dispatch('refreshTable');
}
public function countBookmaker()
@@ -166,6 +175,7 @@ class BettypeToggle extends Component
$this->dispatch('refreshBettypeMenu');
$this->dispatch('refreshTable');
}
public function setDifferences()