This commit is contained in:
salam committed 2026-08-29 16:35:38 +02:00
1 parent 8f6beac89b
commit 82f3654a05
5 files changed
+29 -25

No files matched your search

+15 -13
View File
@@ -20,22 +20,24 @@ class PlayerPerSeason
foreach ($res2 as $val2) {
if (!isset($collection[$val2->event->season])) {
$collection[$val2->event->season]['events_played_home'] = 0;
$collection[$val2->event->season]['events_played_away'] = 0;
$collection[$val2->event->season]['minutes_played_home'] = 0;
$collection[$val2->event->season]['minutes_played_away'] = 0;
}
if (isset($val2->event->season)) {
if (!isset($collection[$val2->event->season])) {
$collection[$val2->event->season]['events_played_home'] = 0;
$collection[$val2->event->season]['events_played_away'] = 0;
$collection[$val2->event->season]['minutes_played_home'] = 0;
$collection[$val2->event->season]['minutes_played_away'] = 0;
}
if ((int) $val2->minutes_played > 0) {
if ($val2->activeteam_id == $val2->event->home_id) {
if ((int) $val2->minutes_played > 0) {
if ($val2->activeteam_id == $val2->event->home_id) {
$collection[$val2->event->season]['events_played_home'] += 1;
$collection[$val2->event->season]['minutes_played_home'] += $val2->minutes_played;
} else if ($val2->activeteam_id == $val2->event->away_id) {
$collection[$val2->event->season]['events_played_home'] += 1;
$collection[$val2->event->season]['minutes_played_home'] += $val2->minutes_played;
} else if ($val2->activeteam_id == $val2->event->away_id) {
$collection[$val2->event->season]['events_played_away'] += 1;
$collection[$val2->event->season]['minutes_played_away'] += $val2->minutes_played;
$collection[$val2->event->season]['events_played_away'] += 1;
$collection[$val2->event->season]['minutes_played_away'] += $val2->minutes_played;
}
}
}
}
+8 -6
View File
@@ -13,15 +13,15 @@ class LoadPlayer
{
$team_id = $get('team_id');
$season = $get('season');
// $season = $get('season');
$team_position = $get('team_position');
$season_or_date = $filter['season_or_date'] ?? 'season';
// $season_or_date = $filter['season_or_date'] ?? 'season';
if ($season_or_date != 'season' or !count($season)) {
$season[] = date('Y');
}
// if ($season_or_date != 'season' or !count($season)) {
// $season[] = date('Y');
// }
$matches = StatistikoEvent::where(function ($query) use ($team_id, $team_position) {
switch ($team_position) {
@@ -43,7 +43,9 @@ class LoadPlayer
$positions_map = LoadPositions::load();
// needs to run daily for pre-calculaton
$player = SofaScorePlayerPerSeason::with('details')->where('ss_team_id', $team_id)->whereIn('season', $season)->get();
$player = SofaScorePlayerPerSeason::with('details')->where('ss_team_id', $team_id)->get();
// dd($player);
$arr = [];
foreach ($player as $val) {
@@ -130,6 +130,7 @@ class LoadEventsQuery
$arr = [];
foreach ($res as $value) {
$tmp = [];
$tmp['match_id'] = $value->match_id;
$tmp['sport_id'] = $value->sport_id;
@@ -143,8 +144,8 @@ class LoadEventsQuery
$tmp['exp_handicap'] = $value->exp_handicap;
$tmp['exp_total'] = $value->exp_total;
$tmp['result_code'] = $value->result_code;
$tmp['home'] = $value->home->ss_team_name;
$tmp['away'] = $value->away->ss_team_name;
$tmp['home'] = $value->home->ss_team_name ?? 0;
$tmp['away'] = $value->away->ss_team_name ?? 0;
switch ($statistic_type) {
case 'gls':
+2 -3
View File
@@ -24,9 +24,6 @@ class LoadPlayer
$ss_player_id = (int) $filter['ss_player_id'] ?? 0;
$start = $filter['start_date'] ?? 0;
$end = $filter['end_date'] ?? 0;
$statistic_type = $filter['statistic_type'] ?? 'gls';
@@ -50,6 +47,8 @@ class LoadPlayer
$res = StatistikoPlayer::with('event')->where('ss_player_id', (int) $ss_player_id)->get();
// dd($res);
$tmp = [];
foreach ($res as $value) {
@@ -18,7 +18,7 @@ return new class extends Migration
$table->integer('country_id')->default(0)->nullable()->index()->references('id')->on('countries');
$table->integer('ss_team_id')->index();
$table->string('ss_team_name');
$table->string('slug');
$table->string('slug')->nullable();
$table->boolean('is_active')->default(false);
$table->boolean('disabled')->default(false);
$table->boolean('grapped')->default(false);