diff --git a/install-kit-awindows-20260427-211240/windows/worktime-session-collector.ps1 b/install-kit-awindows-20260427-211240/windows/worktime-session-collector.ps1 index f1b04ef..226a500 100644 --- a/install-kit-awindows-20260427-211240/windows/worktime-session-collector.ps1 +++ b/install-kit-awindows-20260427-211240/windows/worktime-session-collector.ps1 @@ -98,6 +98,13 @@ function Get-SessionRecords { return $records } +function Test-SessionIsActive { + param([AllowNull()][string]$State) + if ([string]::IsNullOrWhiteSpace($State)) { return $false } + $s = $State.Trim().ToLowerInvariant() + return ($s -eq 'active') -or ($s -like 'актив*') +} + $cfg = Get-Config -Path $ConfigPath $hostValue = if ($Hostname) { $Hostname } else { [string]$env:COMPUTERNAME } $apiBase = '{0}://{1}:{2}/api/0' -f [string]$cfg.server.scheme, [string]$cfg.server.host, [string]$cfg.server.port @@ -137,7 +144,7 @@ while ($true) { sessionId = [int]$rec.sessionId sessionName = [string]$rec.sessionName state = [string]$rec.state - active = ($rec.state -match 'Active') + active = (Test-SessionIsActive -State ([string]$rec.state)) hostname = $hostValue source = 'worktime-session-collector' } diff --git a/windows/worktime-session-collector.ps1 b/windows/worktime-session-collector.ps1 index 7c15ece..7ebf555 100644 --- a/windows/worktime-session-collector.ps1 +++ b/windows/worktime-session-collector.ps1 @@ -103,6 +103,13 @@ function Get-SessionRecords { return $records } +function Test-SessionIsActive { + param([AllowNull()][string]$State) + if ([string]::IsNullOrWhiteSpace($State)) { return $false } + $s = $State.Trim().ToLowerInvariant() + return ($s -eq 'active') -or ($s -like 'актив*') +} + $cfg = Get-Config -Path $ConfigPath $hostValue = if ($Hostname) { $Hostname } else { [string]$env:COMPUTERNAME } $apiBase = '{0}://{1}:{2}/api/0' -f [string]$cfg.server.scheme, [string]$cfg.server.host, [string]$cfg.server.port @@ -142,7 +149,7 @@ while ($true) { sessionId = [int]$rec.sessionId sessionName = [string]$rec.sessionName state = [string]$rec.state - active = ($rec.state -match 'Active') + active = (Test-SessionIsActive -State ([string]$rec.state)) hostname = $hostValue source = 'worktime-session-collector' }