From c6b7cc6b2c37ca40c9a77c5f41510bfef892b304 Mon Sep 17 00:00:00 2001 From: Thijs Stobbelaar 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'); -- 2.49.1 From 292e5d73a86e7534af33862f3efa99e2775c1110 Mon Sep 17 00:00:00 2001 From: Thijs Stobbelaar 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'])) { -- 2.49.1 From 395c1e3d2560f72bd089f41b1520378d7e050a6d Mon Sep 17 00:00:00 2001 From: Thijs Stobbelaar 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 " -- 2.49.1 From 9e63046aff2a512b259a6ba4a19096621c65588a Mon Sep 17 00:00:00 2001 From: Thijs Stobbelaar 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 . "

"; ?> -- 2.49.1 From ac729453e3deb45f8665b88a73d2fe22967f733e Mon Sep 17 00:00:00 2001 From: Thijs Stobbelaar 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) { -- 2.49.1 From bee71313af35c3c64b7aa2bc441a5912716f1ee8 Mon Sep 17 00:00:00 2001 From: Thijs Stobbelaar 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'); -- 2.49.1 From 42d4ea396121355db7a2043c3c9ffb113497ef65 Mon Sep 17 00:00:00 2001 From: Thijs Stobbelaar 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" -- 2.49.1 From 9e813c3df4a848d050d45ac207b1d019bf7f9744 Mon Sep 17 00:00:00 2001 From: Thijs Stobbelaar 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 -- 2.49.1 From 3be08123a30fcf60589f172e4dfb0fc20a9f0d55 Mon Sep 17 00:00:00 2001 From: Thijs Stobbelaar 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 -- 2.49.1
Match DateGame ModeMatch TypeMapKillsDamage DealtTime Survivedwin Place