Skip to content

Commit

Permalink
fix: correctly show dmg taken/dealt (#1182)
Browse files Browse the repository at this point in the history
  • Loading branch information
iBotPeaches committed Feb 24, 2024
1 parent ddce2ed commit da98fbd
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
2 changes: 1 addition & 1 deletion app/Jobs/ExportScrimPlayers.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public function handle(): array
'kd' => $mergedStat->kd,
'kda' => $mergedStat->kda,
'accuracy' => $mergedStat->accuracy,
'damageDone' => $mergedStat->damageDealt,
'damageDone' => $mergedStat->damage_dealt,
'damageTaken' => $mergedStat->damage_taken,
'avgScore' => $mergedStat->score,
'avgRank' => $mergedStat->rank,
Expand Down
8 changes: 5 additions & 3 deletions app/Support/Scrim/ScrimDecorator.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ public function __construct(Scrim $scrim)
$this->mergedStats[$playerId]['accuracy'] += $gamePlayer->accuracy;
$this->mergedStats[$playerId]['score'] += $gamePlayer->score;
$this->mergedStats[$playerId]['rank'] += $gamePlayer->rank;
$this->mergedStats[$playerId]['damageDealt'] += $gamePlayer->damage_dealt;
$this->mergedStats[$playerId]['damageTaken'] += $gamePlayer->damage_taken;
$this->mergedStats[$playerId]['damage_dealt'] += $gamePlayer->damage_dealt;
$this->mergedStats[$playerId]['damage_taken'] += $gamePlayer->damage_taken;
}
});
});
Expand All @@ -51,7 +51,9 @@ public function __construct(Scrim $scrim)
}

usort($this->mergedStats, function (GamePlayer $a, GamePlayer $b) {
return $a['rank'] <=> $b['rank'];
$gamesPlayed = $b['gameCount'] <=> $a['gameCount'];

return $gamesPlayed !== 0 ? $gamesPlayed : $a['rank'] <=> $b['rank'];
});
}
}
6 changes: 4 additions & 2 deletions resources/views/livewire/scrim-players.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<thead>
<tr>
<th>Gamertag</th>
<th><abbr title="Games Played">GP</abbr></th>
<th><abbr title="Kills">K</abbr></th>
<th><abbr title="Deaths">D</abbr></th>
<th><abbr title="Assists">A</abbr></th>
Expand Down Expand Up @@ -34,6 +35,7 @@
</div>
</article>
</td>
<td>{{ $gamePlayer->gameCount }}</td>
<td>{{ $gamePlayer->kills }}</td>
<td>{{ $gamePlayer->deaths }}</td>
<td>{{ $gamePlayer->assists }}</td>
Expand All @@ -47,10 +49,10 @@
{{ number_format($gamePlayer->accuracy, 2) }}%
</td>
<td>
{{ number_format($gamePlayer->damageDealt, 0) }}
{{ number_format($gamePlayer->damage_dealt, 0) }}
</td>
<td>
{{ number_format($gamePlayer->damageTaken, 0) }}
{{ number_format($gamePlayer->damage_taken, 0) }}
</td>
<td>{{ $gamePlayer->formatted_score }}</td>
<td>
Expand Down

0 comments on commit da98fbd

Please sign in to comment.