From 8314f714029c6eb925c601a9591909fc707c968e Mon Sep 17 00:00:00 2001 From: Ingo Oppermann Date: Mon, 10 Oct 2022 16:55:43 +0200 Subject: [PATCH] Fix widget session data --- http/handler/api/widget.go | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/http/handler/api/widget.go b/http/handler/api/widget.go index 7bd22602..5672ba5d 100644 --- a/http/handler/api/widget.go +++ b/http/handler/api/widget.go @@ -2,6 +2,7 @@ package api import ( "net/http" + "strings" "github.com/datarhei/core/v16/http/api" "github.com/datarhei/core/v16/http/handler/util" @@ -73,12 +74,18 @@ func (w *WidgetHandler) Get(c echo.Context) error { summary := collector.Summary() for _, session := range summary.Active { - if session.Reference == process.Reference { - data.CurrentSessions++ + if !strings.HasPrefix(session.Reference, process.Reference) { + continue } + + data.CurrentSessions++ } - if s, ok := summary.Summary.References[process.Reference]; ok { + for reference, s := range summary.Summary.References { + if !strings.HasPrefix(reference, process.Reference) { + continue + } + data.TotalSessions = s.TotalSessions }