From 6556c8049c4ebf6d93c36fb9b2c569f759fe3207 Mon Sep 17 00:00:00 2001 From: Daniel Ponte Date: Wed, 6 Nov 2024 14:20:15 -0500 Subject: [PATCH] Don't apply talkgroup weight twice Also tag ID fields --- pkg/alerting/alerting.go | 7 ++----- pkg/talkgroups/talkgroup.go | 4 ++-- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/pkg/alerting/alerting.go b/pkg/alerting/alerting.go index cf83f66..3222a3e 100644 --- a/pkg/alerting/alerting.go +++ b/pkg/alerting/alerting.go @@ -169,11 +169,8 @@ func (as *alerter) eval(ctx context.Context, now time.Time, testMode bool) ([]Al for _, s := range as.scores { origScore := s.Score tgr, err := as.tgCache.TG(ctx, s.ID) - if err == nil { - if !tgr.Talkgroup.Alert { - continue - } - s.Score *= float64(tgr.Talkgroup.Weight) + if err == nil && !tgr.Talkgroup.Alert { + continue } if s.Score > as.cfg.AlertThreshold || testMode { diff --git a/pkg/talkgroups/talkgroup.go b/pkg/talkgroups/talkgroup.go index a988c24..a491661 100644 --- a/pkg/talkgroups/talkgroup.go +++ b/pkg/talkgroups/talkgroup.go @@ -13,8 +13,8 @@ type Talkgroup struct { } type ID struct { - System uint32 - Talkgroup uint32 + System uint32 `json:"sys"` + Talkgroup uint32 `json:"tg"` } type IDs []ID