wip
This commit is contained in:
1 parent
3461b20afd
commit
2526c9001e
1 file changed
+45
-44
+45
-44
@@ -128,8 +128,6 @@ trait UpdateHelper
|
||||
$collection = [];
|
||||
foreach ($res as $val) {
|
||||
|
||||
dd($val);
|
||||
|
||||
$ss_player_id = (int) $val->ss_player_id;
|
||||
$activeteam_id = (int) $val->activeteam_id;
|
||||
$minutes_played = (int) $val->minutes_played;
|
||||
@@ -138,53 +136,56 @@ trait UpdateHelper
|
||||
$home_id = (int) $val->event->home_id;
|
||||
$away_id = (int) $val->event->away_id;
|
||||
|
||||
if (! isset($collection[$season][$ss_player_id])) {
|
||||
$this->array_template($collection, $ss_player_id, $season);
|
||||
}
|
||||
if (! isset($collection['total'][$ss_player_id])) {
|
||||
$this->array_template($collection, $ss_player_id, 'total');
|
||||
}
|
||||
if ($season) {
|
||||
|
||||
if ($minutes_played > 0) {
|
||||
if ($activeteam_id == $home_id) {
|
||||
$collection[$season][$ss_player_id]['events_played_home'] += 1;
|
||||
$collection[$season][$ss_player_id]['minutes_played_home'] += $minutes_played;
|
||||
$collection['total'][$ss_player_id]['events_played_home'] += 1;
|
||||
$collection['total'][$ss_player_id]['minutes_played_home'] += $minutes_played;
|
||||
} elseif ($activeteam_id == $away_id) {
|
||||
$collection[$season][$ss_player_id]['events_played_away'] += 1;
|
||||
$collection[$season][$ss_player_id]['minutes_played_away'] += $minutes_played;
|
||||
$collection['total'][$ss_player_id]['minutes_played_away'] += 1;
|
||||
$collection['total'][$ss_player_id]['minutes_played_away'] += $minutes_played;
|
||||
if (! isset($collection[$season][$ss_player_id])) {
|
||||
$this->array_template($collection, $ss_player_id, $season);
|
||||
}
|
||||
if (! isset($collection['total'][$ss_player_id])) {
|
||||
$this->array_template($collection, $ss_player_id, 'total');
|
||||
}
|
||||
|
||||
$cards = $val->card_yellow + $val->card_yellowred + $val->card_red;
|
||||
if ($minutes_played > 0) {
|
||||
if ($activeteam_id == $home_id) {
|
||||
$collection[$season][$ss_player_id]['events_played_home'] += 1;
|
||||
$collection[$season][$ss_player_id]['minutes_played_home'] += $minutes_played;
|
||||
$collection['total'][$ss_player_id]['events_played_home'] += 1;
|
||||
$collection['total'][$ss_player_id]['minutes_played_home'] += $minutes_played;
|
||||
} elseif ($activeteam_id == $away_id) {
|
||||
$collection[$season][$ss_player_id]['events_played_away'] += 1;
|
||||
$collection[$season][$ss_player_id]['minutes_played_away'] += $minutes_played;
|
||||
$collection['total'][$ss_player_id]['minutes_played_away'] += 1;
|
||||
$collection['total'][$ss_player_id]['minutes_played_away'] += $minutes_played;
|
||||
}
|
||||
|
||||
$collection[$season][$ss_player_id]['ss_player_id'] = $ss_player_id;
|
||||
$collection[$season][$ss_player_id]['ss_team_id'] = $ss_team_id;
|
||||
$collection[$season][$ss_player_id]['season'] = $season;
|
||||
$collection[$season][$ss_player_id]['total_events']++;
|
||||
$collection[$season][$ss_player_id]['total_min'] += $minutes_played;
|
||||
$collection[$season][$ss_player_id]['average_min'] = round($collection[$season][$ss_player_id]['total_min'] / $collection[$season][$ss_player_id]['total_events']);
|
||||
$collection[$season][$ss_player_id]['goals'] += $val->goals;
|
||||
$collection[$season][$ss_player_id]['fouls'] += $val->fouls;
|
||||
$collection[$season][$ss_player_id]['cards'] += $cards;
|
||||
$collection[$season][$ss_player_id]['offsides'] += $val->offsides;
|
||||
$collection[$season][$ss_player_id]['shots_on_target'] += $val->shots_on_target;
|
||||
$collection[$season][$ss_player_id]['shots_off_target'] += $val->shots_off_target;
|
||||
$cards = $val->card_yellow + $val->card_yellowred + $val->card_red;
|
||||
|
||||
$collection['total'][$ss_player_id]['ss_player_id'] = $ss_player_id;
|
||||
$collection['total'][$ss_player_id]['ss_team_id'] = $ss_team_id;
|
||||
$collection['total'][$ss_player_id]['season'] = 'total';
|
||||
$collection['total'][$ss_player_id]['total_events']++;
|
||||
$collection['total'][$ss_player_id]['total_min'] += $minutes_played;
|
||||
$collection['total'][$ss_player_id]['average_min'] = round($collection['total'][$ss_player_id]['total_min'] / $collection['total'][$ss_player_id]['total_events']);
|
||||
$collection['total'][$ss_player_id]['goals'] += $val->goals;
|
||||
$collection['total'][$ss_player_id]['fouls'] += $val->fouls;
|
||||
$collection['total'][$ss_player_id]['cards'] += $cards;
|
||||
$collection['total'][$ss_player_id]['offsides'] += $val->offsides;
|
||||
$collection['total'][$ss_player_id]['shots_on_target'] += $val->shots_on_target;
|
||||
$collection['total'][$ss_player_id]['shots_off_target'] += $val->shots_off_target;
|
||||
$collection[$season][$ss_player_id]['ss_player_id'] = $ss_player_id;
|
||||
$collection[$season][$ss_player_id]['ss_team_id'] = $ss_team_id;
|
||||
$collection[$season][$ss_player_id]['season'] = $season;
|
||||
$collection[$season][$ss_player_id]['total_events']++;
|
||||
$collection[$season][$ss_player_id]['total_min'] += $minutes_played;
|
||||
$collection[$season][$ss_player_id]['average_min'] = round($collection[$season][$ss_player_id]['total_min'] / $collection[$season][$ss_player_id]['total_events']);
|
||||
$collection[$season][$ss_player_id]['goals'] += $val->goals;
|
||||
$collection[$season][$ss_player_id]['fouls'] += $val->fouls;
|
||||
$collection[$season][$ss_player_id]['cards'] += $cards;
|
||||
$collection[$season][$ss_player_id]['offsides'] += $val->offsides;
|
||||
$collection[$season][$ss_player_id]['shots_on_target'] += $val->shots_on_target;
|
||||
$collection[$season][$ss_player_id]['shots_off_target'] += $val->shots_off_target;
|
||||
|
||||
$collection['total'][$ss_player_id]['ss_player_id'] = $ss_player_id;
|
||||
$collection['total'][$ss_player_id]['ss_team_id'] = $ss_team_id;
|
||||
$collection['total'][$ss_player_id]['season'] = 'total';
|
||||
$collection['total'][$ss_player_id]['total_events']++;
|
||||
$collection['total'][$ss_player_id]['total_min'] += $minutes_played;
|
||||
$collection['total'][$ss_player_id]['average_min'] = round($collection['total'][$ss_player_id]['total_min'] / $collection['total'][$ss_player_id]['total_events']);
|
||||
$collection['total'][$ss_player_id]['goals'] += $val->goals;
|
||||
$collection['total'][$ss_player_id]['fouls'] += $val->fouls;
|
||||
$collection['total'][$ss_player_id]['cards'] += $cards;
|
||||
$collection['total'][$ss_player_id]['offsides'] += $val->offsides;
|
||||
$collection['total'][$ss_player_id]['shots_on_target'] += $val->shots_on_target;
|
||||
$collection['total'][$ss_player_id]['shots_off_target'] += $val->shots_off_target;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user