Skip to content

Commit 2f32876

Browse files
committed
fix non normalized npwr id check
1 parent a0dfd35 commit 2f32876

1 file changed

Lines changed: 10 additions & 7 deletions

File tree

public_html/lib/module/rpcn/inc-rpcn-stats.php

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -152,13 +152,16 @@ private function processStats(): void {
152152
$comm_id_player_count = 0;
153153

154154
// First try psn_games (comm_id)
155-
if (isset($data['psn_games'][$comm_id])) {
156-
$value = $data['psn_games'][$comm_id];
157-
158-
if (is_array($value) && isset($value[0])) {
159-
$comm_id_player_count += (int) $value[0];
160-
} elseif (is_int($value)) {
161-
$comm_id_player_count += $value;
155+
$normalized_entry_id = $this->normalize_id($comm_id);
156+
if (isset($data['psn_games']) && is_array($data['psn_games'])) {
157+
foreach ($data['psn_games'] as $api_title_id => $value) {
158+
if ($this->normalize_id($api_title_id) === $normalized_entry_id) {
159+
if (is_array($value) && isset($value[0])) {
160+
$comm_id_player_count += (int) $value[0];
161+
} elseif (is_int($value)) {
162+
$comm_id_player_count += $value;
163+
}
164+
}
162165
}
163166
}
164167

0 commit comments

Comments
 (0)