Report losers #215

Merged
OpzekerIT merged 2 commits from dev into main 2025-04-15 09:59:24 +00:00
3 changed files with 20 additions and 9 deletions
Showing only changes of commit 6d3abe2265 - Show all commits

View file

@ -14,9 +14,9 @@ jobs:
id: set-destination id: set-destination
run: | run: |
if [[ "${{ github.ref }}" == "refs/heads/main" ]]; then if [[ "${{ github.ref }}" == "refs/heads/main" ]]; then
echo "DESTINATION=/Lantaeu/dtch/" >> $GITHUB_ENV echo "DESTINATION=/LantaeuSSD/dtch/" >> $GITHUB_ENV
else else
echo "DESTINATION=/Lantaeu/dtch_dev/" >> $GITHUB_ENV echo "DESTINATION=/LantaeuSSD/dtch_dev/" >> $GITHUB_ENV
fi fi
- name: Checkout - name: Checkout
@ -25,6 +25,7 @@ jobs:
- name: SFTP upload - name: SFTP upload
uses: Dylan700/sftp-upload-action@latest uses: Dylan700/sftp-upload-action@latest
with: with:
dry-run: false
server: ${{secrets.SYNADDR}} server: ${{secrets.SYNADDR}}
username: ${{secrets.SYNUSR}} username: ${{secrets.SYNUSR}}
password: ${{secrets.SYNPASS}} password: ${{secrets.SYNPASS}}
@ -32,7 +33,6 @@ jobs:
uploads: | uploads: |
./ => ${{ env.DESTINATION }} ./ => ${{ env.DESTINATION }}
ignore: | ignore: |
*.git .git
*/**/*git*
config.php config.php
data/**/*.json data/**/*.json

View file

@ -1,13 +1,21 @@
Start-Transcript -Path '/var/log/dtch/report_new_matches.log' -Append $logprefix = Get-Date -Format "ddMMyyyy_HHmmss"
if ($PSScriptRoot.length -eq 0) { if ($PSScriptRoot.length -eq 0) {
$scriptroot = Get-Location $scriptroot = Get-Location
} }
else { else {
$scriptroot = $PSScriptRoot $scriptroot = $PSScriptRoot
} }
$RelativeLogdir = Join-Path -Path $scriptroot -ChildPath "..\logs"
$logDir = (Resolve-Path -Path $RelativeLogdir).Path
Start-Transcript -Path "$logDir/report_new_matches_$logprefix.log" -Append
. $scriptroot\..\includes\ps1\lockfile.ps1 . $scriptroot\..\includes\ps1\lockfile.ps1
new-lock -by "report_new_matches" 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 $fileContent = Get-Content -Path "$scriptroot/../config/config.php" -Raw
@ -85,6 +93,8 @@ try {
catch { catch {
Write-Output 'Unable to read file exitin' 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 $new_win_matches = $player_matches[-1].new_win_matches
# Gebruik nu de lijst van nieuwe verloren matches uit het JSON-bestand # Gebruik nu de lijst van nieuwe verloren matches uit het JSON-bestand
@ -123,10 +133,10 @@ foreach ($winid in $new_win_matches) {
continue continue
} #skip tdm matches } #skip tdm matches
if ($winmatches[0].matchType -eq 'custom') { if ($winmatches[0].matchType -eq 'custom') {
$players_to_report = $match_stats.included.attributes.stats $players_to_report = $match_stats.included.attributes.stats | where-object { $_.playerId -notlike "ai.*" }
} }
else { else {
$players_to_report = ($match_stats.included.attributes.stats | where-object { $_.winplace -eq 1 }) $players_to_report = $match_stats.included.attributes.stats | where-object { $_.winplace -eq 1 }
} }
if ($new_win_matches.count -le 10) { if ($new_win_matches.count -le 10) {

1
logs/REAMD.MD Normal file
View file

@ -0,0 +1 @@
Location for logs