From 7eade7a5d3b57009a687c0ec2b851831af4b03a7 Mon Sep 17 00:00:00 2001 From: Lanta Date: Wed, 22 Nov 2023 15:53:29 +0100 Subject: [PATCH 1/9] test without filter --- latestmatches.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/latestmatches.php b/latestmatches.php index be2bd21..a9d71c5 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 "
@@ -64,11 +64,11 @@ $ogDescription = "Dive into the detailed match stats of DTCH Clan in PUBG. Explo if ($match['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'); From de35b03e29feb6aaa189cb57e305523a878fcdbc Mon Sep 17 00:00:00 2001 From: Lanta Date: Wed, 22 Nov 2023 15:55:37 +0100 Subject: [PATCH 2/9] change in compare operator --- latestmatches.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/latestmatches.php b/latestmatches.php index a9d71c5..5ee02ac 100644 --- a/latestmatches.php +++ b/latestmatches.php @@ -61,7 +61,7 @@ $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) { + if ($match['stats']['name'] == $selected_player) { // if (isset($_GET['filter_by_match_type'])) { From f2885d69a3aafb74fdabc8c686d6b9fa213ebbe2 Mon Sep 17 00:00:00 2001 From: Lanta Date: Wed, 22 Nov 2023 15:59:39 +0100 Subject: [PATCH 3/9] stats --- latestmatches.php | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/latestmatches.php b/latestmatches.php index 5ee02ac..c9542ef 100644 --- a/latestmatches.php +++ b/latestmatches.php @@ -61,14 +61,15 @@ $ogDescription = "Dive into the detailed match stats of DTCH Clan in PUBG. Explo echo "
Match DateGame ModeMatch TypeMapKillsDamage DealtTime Survivedwin Place
"; echo ""; foreach ($players_matches as $match) { - if ($match['stats']['name'] == $selected_player) { + 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'); @@ -76,10 +77,10 @@ $ogDescription = "Dive into the detailed match stats of DTCH Clan in PUBG. Explo $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']; + $kills = $stats['kills']; + $damage = number_format($stats['damageDealt'], 0, '.', ''); + $timeSurvived = $stats['timeSurvived']; + $winPlace = $stats['winPlace']; echo " From 165f30188ad421dbaa4678eb42261d0721387ed1 Mon Sep 17 00:00:00 2001 From: Lanta Date: Wed, 22 Nov 2023 16:00:35 +0100 Subject: [PATCH 4/9] foreach --- latestmatches.php | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/latestmatches.php b/latestmatches.php index c9542ef..4baa8ea 100644 --- a/latestmatches.php +++ b/latestmatches.php @@ -61,27 +61,27 @@ $ogDescription = "Dive into the detailed match stats of DTCH Clan in PUBG. Explo echo "
Match DateGame ModeMatch TypeMapKillsDamage DealtTime Survivedwin Place
" . $formattedDate . " " . $gameMode . "
"; echo ""; foreach ($players_matches as $match) { - foreach($match['stats'] as $stats) - if ($stats['name'] === $selected_player) { + 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 = $stats['kills']; - $damage = number_format($stats['damageDealt'], 0, '.', ''); - $timeSurvived = $stats['timeSurvived']; - $winPlace = $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 " @@ -95,8 +95,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 . "

"; ?> From e59980b2f241a1ef9855a93e2c918c19f852fd4f Mon Sep 17 00:00:00 2001 From: Lanta Date: Wed, 22 Nov 2023 16:01:59 +0100 Subject: [PATCH 5/9] $match['stats'] --- latestmatches.php | 1 + 1 file changed, 1 insertion(+) diff --git a/latestmatches.php b/latestmatches.php index 4baa8ea..682d693 100644 --- a/latestmatches.php +++ b/latestmatches.php @@ -61,6 +61,7 @@ $ogDescription = "Dive into the detailed match stats of DTCH Clan in PUBG. Explo echo ""; echo ""; foreach ($players_matches as $match) { + print_r($match['stats']); foreach ($match['stats'] as $stats) { if ($stats['name'] === $selected_player) { From 593131c161c7820e39d352e2d7297b744d611d66 Mon Sep 17 00:00:00 2001 From: Lanta Date: Wed, 22 Nov 2023 16:06:12 +0100 Subject: [PATCH 6/9] contiun --- latestmatches.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/latestmatches.php b/latestmatches.php index 682d693..de2b080 100644 --- a/latestmatches.php +++ b/latestmatches.php @@ -66,11 +66,11 @@ $ogDescription = "Dive into the detailed match stats of DTCH Clan in PUBG. Explo 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'); From 597b93f4eab6847ea6182ed42d4e8f0b092180c2 Mon Sep 17 00:00:00 2001 From: Lanta Date: Wed, 22 Nov 2023 16:09:38 +0100 Subject: [PATCH 7/9] update --- latestmatches.php | 12 ++++++------ update/get_matches.ps1 | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/latestmatches.php b/latestmatches.php index de2b080..6b14763 100644 --- a/latestmatches.php +++ b/latestmatches.php @@ -61,16 +61,16 @@ $ogDescription = "Dive into the detailed match stats of DTCH Clan in PUBG. Explo echo "
Match DateGame ModeMatch TypeMapKillsDamage DealtTime Survivedwin Place
"; echo ""; foreach ($players_matches as $match) { - print_r($match['stats']); + // 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'); diff --git a/update/get_matches.ps1 b/update/get_matches.ps1 index 5430119..8b81b89 100644 --- a/update/get_matches.ps1 +++ b/update/get_matches.ps1 @@ -114,7 +114,7 @@ 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" From be06fb06cad2a5c369b4c920b01694bc86394711 Mon Sep 17 00:00:00 2001 From: Lanta Date: Wed, 22 Nov 2023 16:11:09 +0100 Subject: [PATCH 8/9] date sort --- update/get_matches.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/update/get_matches.ps1 b/update/get_matches.ps1 index 8b81b89..fb688bc 100644 --- a/update/get_matches.ps1 +++ b/update/get_matches.ps1 @@ -120,7 +120,7 @@ foreach ($file in $matchfiles) { write-output "NEW $matchfiledate" } } -$player_matches_object | convertto-json -Depth 100 | out-file "$scriptroot/../data/cached_matches.json" +$player_matches_object | Sort-Object createdAt| convertto-json -Depth 100 | out-file "$scriptroot/../data/cached_matches.json" remove-lock Stop-Transcript \ No newline at end of file From 8f7a3e38c9491233f719a8c17046ceca13a3fc65 Mon Sep 17 00:00:00 2001 From: Lanta Date: Wed, 22 Nov 2023 16:11:57 +0100 Subject: [PATCH 9/9] descending --- update/get_matches.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/update/get_matches.ps1 b/update/get_matches.ps1 index fb688bc..851498d 100644 --- a/update/get_matches.ps1 +++ b/update/get_matches.ps1 @@ -120,7 +120,7 @@ foreach ($file in $matchfiles) { write-output "NEW $matchfiledate" } } -$player_matches_object | Sort-Object createdAt| 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
Match DateGame ModeMatch TypeMapKillsDamage DealtTime Survivedwin Place