fix(worktime): treat russian session state 'Активно' as active

This commit is contained in:
igor04091968
2026-05-07 09:07:19 +03:00
parent cd5fd95faf
commit 669501f20a
2 changed files with 16 additions and 2 deletions
@@ -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'
}
+8 -1
View File
@@ -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'
}