mirror of
https://github.com/datarhei/core.git
synced 2025-10-05 16:07:07 +08:00
Fix widget session data
This commit is contained in:
@@ -2,6 +2,7 @@ package api
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"github.com/datarhei/core/v16/http/api"
|
"github.com/datarhei/core/v16/http/api"
|
||||||
"github.com/datarhei/core/v16/http/handler/util"
|
"github.com/datarhei/core/v16/http/handler/util"
|
||||||
@@ -73,12 +74,18 @@ func (w *WidgetHandler) Get(c echo.Context) error {
|
|||||||
summary := collector.Summary()
|
summary := collector.Summary()
|
||||||
|
|
||||||
for _, session := range summary.Active {
|
for _, session := range summary.Active {
|
||||||
if session.Reference == process.Reference {
|
if !strings.HasPrefix(session.Reference, process.Reference) {
|
||||||
data.CurrentSessions++
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
data.CurrentSessions++
|
||||||
|
}
|
||||||
|
|
||||||
|
for reference, s := range summary.Summary.References {
|
||||||
|
if !strings.HasPrefix(reference, process.Reference) {
|
||||||
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
if s, ok := summary.Summary.References[process.Reference]; ok {
|
|
||||||
data.TotalSessions = s.TotalSessions
|
data.TotalSessions = s.TotalSessions
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user