From dcbe548b38b5d43b173e32e7e0181b273e26a315 Mon Sep 17 00:00:00 2001 From: Lanta Date: Thu, 3 Apr 2025 11:23:06 +0200 Subject: [PATCH 1/3] s --- discord/report_new_matches.ps1 | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/discord/report_new_matches.ps1 b/discord/report_new_matches.ps1 index 992a934..bebe835 100644 --- a/discord/report_new_matches.ps1 +++ b/discord/report_new_matches.ps1 @@ -1,6 +1,4 @@ -$logprefix = get-date -Format ddMMyyy_HHmmss -#up -Start-Transcript -Path "../logs/report_new_matches_$logprefix.log" -Append + if ($PSScriptRoot.length -eq 0) { $scriptroot = Get-Location @@ -8,6 +6,11 @@ if ($PSScriptRoot.length -eq 0) { else { $scriptroot = $PSScriptRoot } + +$logprefix = get-date -Format ddMMyyy_HHmmss +#up +Start-Transcript -Path "$scriptroot/../logs/report_new_matches_$logprefix.log" -Append + . $scriptroot\..\includes\ps1\lockfile.ps1 new-lock -by "report_new_matches" From 9445bbbc05ac9c4ac25ecf04616ccaf1bbcbcf7c Mon Sep 17 00:00:00 2001 From: Lanta Date: Thu, 3 Apr 2025 11:23:19 +0200 Subject: [PATCH 2/3] s --- discord/report_new_matches.ps1 | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/discord/report_new_matches.ps1 b/discord/report_new_matches.ps1 index bebe835..483146d 100644 --- a/discord/report_new_matches.ps1 +++ b/discord/report_new_matches.ps1 @@ -1,6 +1,4 @@ - - -if ($PSScriptRoot.length -eq 0) { +if ($PSScriptRoot.length -eq 0) { $scriptroot = Get-Location } else { @@ -8,7 +6,6 @@ else { } $logprefix = get-date -Format ddMMyyy_HHmmss -#up Start-Transcript -Path "$scriptroot/../logs/report_new_matches_$logprefix.log" -Append . $scriptroot\..\includes\ps1\lockfile.ps1 From 4de3775ed75832d9dece9c60af97c3c3d768755a Mon Sep 17 00:00:00 2001 From: Lanta Date: Thu, 3 Apr 2025 11:37:40 +0200 Subject: [PATCH 3/3] 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