Skip to content

Commit

Permalink
fix: cast negative expected kills to 0 (#1555)
Browse files Browse the repository at this point in the history
  • Loading branch information
iBotPeaches authored Jan 6, 2025
1 parent 892e134 commit 6311fd5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app/Models/GamePlayer.php
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,8 @@ public static function fromDotApi(array $payload): ?self
$gamePlayer->assists_emp ??= Arr::get($payload, $prefix.'stats.core.breakdown.assists.emp');
$gamePlayer->assists_driver ??= Arr::get($payload, $prefix.'stats.core.breakdown.assists.driver');
$gamePlayer->assists_callout ??= Arr::get($payload, $prefix.'stats.core.breakdown.assists.callouts');
$gamePlayer->expected_kills ??= Arr::get($payload, $prefix.'performances.kills.expected');
$gamePlayer->expected_deaths ??= Arr::get($payload, $prefix.'performances.deaths.expected');
$gamePlayer->expected_kills ??= max(Arr::get($payload, $prefix.'performances.kills.expected'), 0);
$gamePlayer->expected_deaths ??= max(Arr::get($payload, $prefix.'performances.deaths.expected'), 0);

if (Arr::has($payload, 'stats.core.breakdown.medals')) {
$gamePlayer->medals = collect((array) Arr::get($payload, $prefix.'stats.core.breakdown.medals'))
Expand Down

0 comments on commit 6311fd5

Please sign in to comment.