wip
This commit is contained in:
1 parent
96598a09aa
commit
cdc8bdfc95
3 files changed
+25
-19
No files matched your search
@@ -102,9 +102,6 @@ class ImportPlayer
|
|||||||
foreach ($fieldnames as $key => $name) {
|
foreach ($fieldnames as $key => $name) {
|
||||||
if ($key == 1) {
|
if ($key == 1) {
|
||||||
$match_id = (int) $row[$key];
|
$match_id = (int) $row[$key];
|
||||||
// if (! $match_id) {
|
|
||||||
// return false;
|
|
||||||
// }
|
|
||||||
} elseif ($key == 2) {
|
} elseif ($key == 2) {
|
||||||
$ss_player_id = (int) $row[$key];
|
$ss_player_id = (int) $row[$key];
|
||||||
} elseif ($key == 3) {
|
} elseif ($key == 3) {
|
||||||
|
|||||||
@@ -420,7 +420,7 @@ class PlayerProps extends Page implements HasForms
|
|||||||
->afterStateUpdated(function (callable $set, $state) {
|
->afterStateUpdated(function (callable $set, $state) {
|
||||||
$set('ss_player_id', null);
|
$set('ss_player_id', null);
|
||||||
// cat all values in array to strings
|
// cat all values in array to strings
|
||||||
$this->dispatch('season_selected-update', season_selected: array_map('strval', $state));
|
$this->dispatch('season_selected-update', season_selected: $state);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
namespace App\Traits\PlayerProps;
|
namespace App\Traits\PlayerProps;
|
||||||
|
|
||||||
use App\Models\StatistikoDetail;
|
use App\Models\StatistikoDetail;
|
||||||
use App\Models\StatistikoEvent;
|
use App\Models\StatistikoPlayer;
|
||||||
use Illuminate\Support\Carbon;
|
use Illuminate\Support\Carbon;
|
||||||
|
|
||||||
// use Illuminate\Support\Facades\Log;
|
// use Illuminate\Support\Facades\Log;
|
||||||
@@ -27,7 +27,6 @@ trait PlayerQuery
|
|||||||
$arr = [];
|
$arr = [];
|
||||||
$res = $this->getPlayers($part, $player_ids);
|
$res = $this->getPlayers($part, $player_ids);
|
||||||
foreach ($res as $val) {
|
foreach ($res as $val) {
|
||||||
|
|
||||||
$ss_player_id = (int) $val->ss_player_id;
|
$ss_player_id = (int) $val->ss_player_id;
|
||||||
$activeteam_id = (int) $val->activeteam_id;
|
$activeteam_id = (int) $val->activeteam_id;
|
||||||
$minutes_played = (int) $val->minutes_played;
|
$minutes_played = (int) $val->minutes_played;
|
||||||
@@ -91,7 +90,6 @@ trait PlayerQuery
|
|||||||
$arr = [];
|
$arr = [];
|
||||||
$res = $this->getPlayers(1, $player_ids);
|
$res = $this->getPlayers(1, $player_ids);
|
||||||
foreach ($res as $val) {
|
foreach ($res as $val) {
|
||||||
|
|
||||||
$ss_player_id = (int) $val->ss_player_id;
|
$ss_player_id = (int) $val->ss_player_id;
|
||||||
$activeteam_id = (int) $val->activeteam_id;
|
$activeteam_id = (int) $val->activeteam_id;
|
||||||
$minutes_played = (int) $val->minutes_played;
|
$minutes_played = (int) $val->minutes_played;
|
||||||
@@ -184,30 +182,41 @@ trait PlayerQuery
|
|||||||
$this->season_selected = $this->getCurrentSeason();
|
$this->season_selected = $this->getCurrentSeason();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$sesson_int_string = [];
|
||||||
|
foreach ($this->season_selected as $value) {
|
||||||
|
if (strpos($value, '/') !== false) {
|
||||||
|
$sesson_int_string[] = (string) $value;
|
||||||
|
} else {
|
||||||
|
$sesson_int_string[] = (string) $value;
|
||||||
|
$sesson_int_string[] = (int) $value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return match ($part) {
|
return match ($part) {
|
||||||
1 => StatistikoEvent::with('details')
|
1 => StatistikoPlayer::with('details')
|
||||||
->whereIn('ss_player_id', $player_ids)
|
->whereIn('ss_player_id', $player_ids)
|
||||||
->when($this->season_selected, function ($query) {
|
->when($this->season_selected, function ($query) use ($sesson_int_string) {
|
||||||
return $query->whereIn('season', $this->season_selected);
|
return $query->whereIn('season', $sesson_int_string);
|
||||||
})->pluck('match_id')->toArray(),
|
})->get(),
|
||||||
2 => StatistikoEvent::with('details')
|
2 => StatistikoPlayer::with('details')
|
||||||
->whereIn('ss_player_id', $player_ids)
|
->whereIn('ss_player_id', $player_ids)
|
||||||
->when($this->season_selected, function ($query) {
|
->when($this->season_selected, function ($query) use ($sesson_int_string) {
|
||||||
return $query->whereNotIn('season', $this->season_selected);
|
return $query->whereNotIn('season', $sesson_int_string);
|
||||||
})->pluck('match_id')->toArray(),
|
})->get(),
|
||||||
};
|
};
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return match ($part) {
|
return match ($part) {
|
||||||
1 => StatistikoEvent::with('details')
|
1 => StatistikoPlayer::with('details')
|
||||||
->whereIn('ss_player_id', $player_ids)
|
->whereIn('ss_player_id', $player_ids)
|
||||||
->when($this->date_spliter, function ($query) {
|
->when($this->date_spliter, function ($query) {
|
||||||
return $query->whereDate('starttime', '>', $this->date_spliter);
|
return $query->whereDate('starttime', '>', $this->date_spliter);
|
||||||
})->pluck('match_id')->toArray(),
|
})->get(),
|
||||||
2 => StatistikoEvent::with('details')
|
2 => StatistikoPlayer::with('details')
|
||||||
->whereIn('ss_player_id', $player_ids)
|
->whereIn('ss_player_id', $player_ids)
|
||||||
->when($this->season_selected, function ($query) {
|
->when($this->season_selected, function ($query) {
|
||||||
return $query->whereDate('starttime', '<=', $this->date_spliter);
|
return $query->whereDate('starttime', '<=', $this->date_spliter);
|
||||||
})->pluck('match_id')->toArray()
|
})->get(),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user