From 4de3775ed75832d9dece9c60af97c3c3d768755a Mon Sep 17 00:00:00 2001 From: Lanta Date: Thu, 3 Apr 2025 11:37:40 +0200 Subject: [PATCH] new --- discord/report_new_matches.ps1 | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/discord/report_new_matches.ps1 b/discord/report_new_matches.ps1 index 483146d..eaca2c0 100644 --- a/discord/report_new_matches.ps1 +++ b/discord/report_new_matches.ps1 @@ -1,15 +1,21 @@ -if ($PSScriptRoot.length -eq 0) { +$logprefix = Get-Date -Format "ddMMyyyy_HHmmss" +if ($PSScriptRoot.length -eq 0) { $scriptroot = Get-Location } else { $scriptroot = $PSScriptRoot } +$RelativeLogdir = Join-Path -Path $scriptroot -ChildPath "..\logs" +$logDir = (Resolve-Path -Path $RelativeLogdir).Path -$logprefix = get-date -Format ddMMyyy_HHmmss -Start-Transcript -Path "$scriptroot/../logs/report_new_matches_$logprefix.log" -Append - +Start-Transcript -Path "$logDir/report_new_matches_$logprefix.log" -Append . $scriptroot\..\includes\ps1\lockfile.ps1 new-lock -by "report_new_matches" +write-output "Scriptroot: $scriptroot" +write-output "Scriptname: $($MyInvocation.MyCommand)" +write-output "Script: $($MyInvocation.MyCommand.Path)" +write-output "PSScriptroot: $PSScriptRoot" +write-output "Logdir: $logDir" $fileContent = Get-Content -Path "$scriptroot/../config/config.php" -Raw @@ -66,11 +72,14 @@ $map_map = @{ } try { + get-content "$scriptroot/../data/player_matches.json" #debug purposes $player_matches = get-content "$scriptroot/../data/player_matches.json" | convertfrom-json -Depth 100 } catch { Write-Output 'Unable to read file exitin' } +write-output $player_matches +Write-Output $new_win_matches $new_win_matches = $player_matches[-1].new_win_matches