fix(worktime): treat russian session state 'Активно' as active
This commit is contained in:
@@ -98,6 +98,13 @@ function Get-SessionRecords {
|
|||||||
return $records
|
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
|
$cfg = Get-Config -Path $ConfigPath
|
||||||
$hostValue = if ($Hostname) { $Hostname } else { [string]$env:COMPUTERNAME }
|
$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
|
$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
|
sessionId = [int]$rec.sessionId
|
||||||
sessionName = [string]$rec.sessionName
|
sessionName = [string]$rec.sessionName
|
||||||
state = [string]$rec.state
|
state = [string]$rec.state
|
||||||
active = ($rec.state -match 'Active')
|
active = (Test-SessionIsActive -State ([string]$rec.state))
|
||||||
hostname = $hostValue
|
hostname = $hostValue
|
||||||
source = 'worktime-session-collector'
|
source = 'worktime-session-collector'
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -103,6 +103,13 @@ function Get-SessionRecords {
|
|||||||
return $records
|
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
|
$cfg = Get-Config -Path $ConfigPath
|
||||||
$hostValue = if ($Hostname) { $Hostname } else { [string]$env:COMPUTERNAME }
|
$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
|
$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
|
sessionId = [int]$rec.sessionId
|
||||||
sessionName = [string]$rec.sessionName
|
sessionName = [string]$rec.sessionName
|
||||||
state = [string]$rec.state
|
state = [string]$rec.state
|
||||||
active = ($rec.state -match 'Active')
|
active = (Test-SessionIsActive -State ([string]$rec.state))
|
||||||
hostname = $hostValue
|
hostname = $hostValue
|
||||||
source = 'worktime-session-collector'
|
source = 'worktime-session-collector'
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user