This commit is contained in:
Thijs Stobbelaar 2023-11-13 20:03:34 +01:00
parent d48e8f01af
commit 2ea734b8d5
2 changed files with 5 additions and 4 deletions

View file

@ -1,4 +1,4 @@
Start-Transcript -Path '/var/log/dtch/report_new_matches.log' -Append Start-Transcript -Path '/var/log/dtch/report_new_matches.log' -Append
if ($PSScriptRoot.length -eq 0) { if ($PSScriptRoot.length -eq 0) {
$scriptroot = Get-Location $scriptroot = Get-Location

View file

@ -11,8 +11,9 @@ else {
. $scriptroot\..\includes\ps1\lockfile.ps1 . $scriptroot\..\includes\ps1\lockfile.ps1
new-lock new-lock
##SETTINGS
$monthsback = -1 # how many months back to look for matches
##END OF SETTINGS
function Get-Change { function Get-Change {
param ( param (
[double]$OldWinRatio, [double]$OldWinRatio,
@ -142,7 +143,7 @@ foreach ($player in $all_player_matches) {
$killstats = @() $killstats = @()
$matchfiles = Get-ChildItem "$scriptroot/../data/killstats/" -File -Filter *.json $matchfiles = Get-ChildItem "$scriptroot/../data/killstats/" -File -Filter *.json
$last_month = (get-date).AddMonths(-1) $last_month = (get-date).AddMonths($monthsback)
foreach ($file in $matchfiles) { foreach ($file in $matchfiles) {
$json = get-content $file | ConvertFrom-Json $json = get-content $file | ConvertFrom-Json
if ($json.created -gt $last_month) { if ($json.created -gt $last_month) {