diff --git a/latestmatches.php b/latestmatches.php index be2bd21..6b14763 100644 --- a/latestmatches.php +++ b/latestmatches.php @@ -31,7 +31,7 @@ $ogDescription = "Dive into the detailed match stats of DTCH Clan in PUBG. Explo } echo "
"; - $selected_player = $_GET['selected_player'] ?? $players[0]; + $selected_player = $_GET['selected_player'] ?? $players['clanMembers'][0]; echo "
@@ -61,26 +61,28 @@ $ogDescription = "Dive into the detailed match stats of DTCH Clan in PUBG. Explo echo ""; echo ""; foreach ($players_matches as $match) { - if ($match['stats']['name'] === $selected_player) { + // print_r($match['stats']); + foreach ($match['stats'] as $stats) { + if ($stats['name'] === $selected_player) { - if (isset($_GET['filter_by_match_type'])) { - if ($_GET['filter_by_match_type'] !== 'all' && $match['matchType'] !== $_GET['filter_by_match_type']) { - continue; + if (isset($_GET['filter_by_match_type'])) { + if ($_GET['filter_by_match_type'] !== 'all' && $match['matchType'] !== $_GET['filter_by_match_type']) { + continue; + } } - } - $date = new DateTime($match['createdAt']); - $date->modify('+1 hours'); - $formattedDate = $date->format('m-d H:i:s'); + $date = new DateTime($match['createdAt']); + $date->modify('+1 hours'); + $formattedDate = $date->format('m-d H:i:s'); - $matchType = $match['matchType']; - $gameMode = $match['gameMode']; - $mapName = isset($mapNames[$match['mapName']]) ? $mapNames[$match['mapName']] : $match['mapName']; - $kills = $match['stats']['kills']; - $damage = number_format($match['stats']['damageDealt'], 0, '.', ''); - $timeSurvived = $match['stats']['timeSurvived']; - $winPlace = $match['stats']['winPlace']; - echo " + $matchType = $match['matchType']; + $gameMode = $match['gameMode']; + $mapName = isset($mapNames[$match['mapName']]) ? $mapNames[$match['mapName']] : $match['mapName']; + $kills = $stats['kills']; + $damage = number_format($stats['damageDealt'], 0, '.', ''); + $timeSurvived = $stats['timeSurvived']; + $winPlace = $stats['winPlace']; + echo " @@ -94,8 +96,8 @@ $ogDescription = "Dive into the detailed match stats of DTCH Clan in PUBG. Explo + } } - } echo "
Match DateGame ModeMatch TypeMapKillsDamage DealtTime Survivedwin Place
" . $formattedDate . " " . $gameMode . " " . $matchType . "

"; ?> diff --git a/update/get_matches.ps1 b/update/get_matches.ps1 index 5430119..851498d 100644 --- a/update/get_matches.ps1 +++ b/update/get_matches.ps1 @@ -114,13 +114,13 @@ foreach ($file in $matchfiles) { createdAt = $filecontent.data.attributes.createdAt mapName = $filecontent.data.attributes.mapName id = $filecontent.data.id - stats = $player_matches_cached + stats = @($player_matches_cached) } } write-output "NEW $matchfiledate" } } -$player_matches_object | convertto-json -Depth 100 | out-file "$scriptroot/../data/cached_matches.json" +$player_matches_object | Sort-Object createdAt -Descending | convertto-json -Depth 100 | out-file "$scriptroot/../data/cached_matches.json" remove-lock Stop-Transcript \ No newline at end of file