Merge pull request #84 from OpzekerIT/dev
last 14 days naar maandelijks
This commit is contained in:
commit
507d20fa01
4 changed files with 18 additions and 7 deletions
|
|
@ -56,7 +56,7 @@ $most_matches = @{
|
|||
}
|
||||
|
||||
$content = "
|
||||
:rocket: Het 2 wekelijkse raportje :rocket:
|
||||
:rocket: Het maandelijks raportje :rocket:
|
||||
|
||||
Hey toppers!
|
||||
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ if ($host == 'dev.dtch.online') {
|
|||
<a href="topstats.php">Top10</a>
|
||||
<a href="topstatsavg.php">Match % T10</a>
|
||||
<a href="latestmatches.php">Last Matches</a>
|
||||
<a href="last_stats.php">Last 14 days %</a>
|
||||
<a href="last_stats.php">Last month %</a>
|
||||
</div>
|
||||
<a href="javascript:void(0);" class="icon" onclick="myFunction()">
|
||||
<i class="fa fa-bars"></i>
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ error_reporting(E_ALL);
|
|||
</header>
|
||||
<main>
|
||||
<section>
|
||||
<h2>Player Stats past 14 days</h2>
|
||||
<h2>Player Stats past 30 days</h2>
|
||||
<?php
|
||||
include './config/config.php';
|
||||
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ else {
|
|||
|
||||
|
||||
$all_player_matches = get-content "$scriptroot/../data/player_matches.json" | convertfrom-json -Depth 100
|
||||
$killstats = @()
|
||||
|
||||
$i = 0
|
||||
|
||||
foreach ($player in $all_player_matches) {
|
||||
|
|
@ -108,12 +108,23 @@ foreach ($player in $all_player_matches) {
|
|||
winplace = (($all_player_matches | where-object { $_.playername -eq $player_name } ).player_matches | where-object {$_.id -eq $match.id}).stats.winplace
|
||||
}
|
||||
$savekillstats | ConvertTo-Json | out-file "$scriptroot/../data/killstats/$($match.id)_$player_name.json"
|
||||
$killstats += $killstat
|
||||
|
||||
} else{
|
||||
write-output "match $($match.id) already in cache"
|
||||
$killstats += (get-content "$scriptroot/../data/killstats/$($match.id)_$player_name.json" | ConvertFrom-Json).stats
|
||||
Write-Output "$($match.id) already in cache"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$killstats = @()
|
||||
$matchfiles = Get-ChildItem "$scriptroot/../data/killstats/" -File -Filter *.json
|
||||
$last_month = (get-date).AddMonths(-1)
|
||||
foreach($file in $matchfiles){
|
||||
$json = get-content $file | ConvertFrom-Json
|
||||
if($json.created -gt $last_month){
|
||||
$killstats += $json.stats
|
||||
}else{
|
||||
write-output "Archiveing $($file.name)"
|
||||
Move-Item -Path $file.FullName -Destination "$scriptroot/../data/killstats/archive" -Force
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue