Merge pull request #140 from OpzekerIT/dev

fixes
This commit is contained in:
Lanta 2023-11-22 16:19:33 +01:00 committed by GitHub
commit 65884e1af4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 20 deletions

View file

@ -31,7 +31,7 @@ $ogDescription = "Dive into the detailed match stats of DTCH Clan in PUBG. Explo
} }
echo "</form><br>"; echo "</form><br>";
$selected_player = $_GET['selected_player'] ?? $players[0]; $selected_player = $_GET['selected_player'] ?? $players['clanMembers'][0];
echo "<form method='get' action=''> echo "<form method='get' action=''>
<input type='submit' name='filter_by_match_type' value='all' class='btn'> <input type='submit' name='filter_by_match_type' value='all' class='btn'>
<input type='submit' name='filter_by_match_type' value='airoyale' class='btn'> <input type='submit' name='filter_by_match_type' value='airoyale' class='btn'>
@ -61,26 +61,28 @@ $ogDescription = "Dive into the detailed match stats of DTCH Clan in PUBG. Explo
echo "<table border='1' class='sortable'>"; echo "<table border='1' class='sortable'>";
echo "<tr><th>Match Date</th><th>Game Mode</th><th>Match Type</th><th>Map</th><th>Kills</th><th>Damage Dealt</th><th>Time Survived</th><th>win Place</th></tr>"; echo "<tr><th>Match Date</th><th>Game Mode</th><th>Match Type</th><th>Map</th><th>Kills</th><th>Damage Dealt</th><th>Time Survived</th><th>win Place</th></tr>";
foreach ($players_matches as $match) { 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 (isset($_GET['filter_by_match_type'])) {
if ($_GET['filter_by_match_type'] !== 'all' && $match['matchType'] !== $_GET['filter_by_match_type']) { if ($_GET['filter_by_match_type'] !== 'all' && $match['matchType'] !== $_GET['filter_by_match_type']) {
continue; continue;
}
} }
} $date = new DateTime($match['createdAt']);
$date = new DateTime($match['createdAt']); $date->modify('+1 hours');
$date->modify('+1 hours'); $formattedDate = $date->format('m-d H:i:s');
$formattedDate = $date->format('m-d H:i:s');
$matchType = $match['matchType']; $matchType = $match['matchType'];
$gameMode = $match['gameMode']; $gameMode = $match['gameMode'];
$mapName = isset($mapNames[$match['mapName']]) ? $mapNames[$match['mapName']] : $match['mapName']; $mapName = isset($mapNames[$match['mapName']]) ? $mapNames[$match['mapName']] : $match['mapName'];
$kills = $match['stats']['kills']; $kills = $stats['kills'];
$damage = number_format($match['stats']['damageDealt'], 0, '.', ''); $damage = number_format($stats['damageDealt'], 0, '.', '');
$timeSurvived = $match['stats']['timeSurvived']; $timeSurvived = $stats['timeSurvived'];
$winPlace = $match['stats']['winPlace']; $winPlace = $stats['winPlace'];
echo "<tr> echo "<tr>
<td><a href='matchinfo.php?matchid=" . $match['id'] . "'>" . $formattedDate . "</a></td> <td><a href='matchinfo.php?matchid=" . $match['id'] . "'>" . $formattedDate . "</a></td>
<td><a href='matchinfo.php?matchid=" . $match['id'] . "'>" . $gameMode . "</a></td> <td><a href='matchinfo.php?matchid=" . $match['id'] . "'>" . $gameMode . "</a></td>
<td><a href='matchinfo.php?matchid=" . $match['id'] . "'>" . $matchType . "</a></td> <td><a href='matchinfo.php?matchid=" . $match['id'] . "'>" . $matchType . "</a></td>
@ -94,8 +96,8 @@ $ogDescription = "Dive into the detailed match stats of DTCH Clan in PUBG. Explo
}
} }
} }
echo "</table><br>"; echo "</table><br>";
?> ?>

View file

@ -114,13 +114,13 @@ foreach ($file in $matchfiles) {
createdAt = $filecontent.data.attributes.createdAt createdAt = $filecontent.data.attributes.createdAt
mapName = $filecontent.data.attributes.mapName mapName = $filecontent.data.attributes.mapName
id = $filecontent.data.id id = $filecontent.data.id
stats = $player_matches_cached stats = @($player_matches_cached)
} }
} }
write-output "NEW $matchfiledate" 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 remove-lock
Stop-Transcript Stop-Transcript