Don't apply talkgroup weight twice
Also tag ID fields
This commit is contained in:
parent
08f1bd4ff0
commit
6556c8049c
2 changed files with 4 additions and 7 deletions
|
@ -169,12 +169,9 @@ 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 {
|
||||
if err == nil && !tgr.Talkgroup.Alert {
|
||||
continue
|
||||
}
|
||||
s.Score *= float64(tgr.Talkgroup.Weight)
|
||||
}
|
||||
|
||||
if s.Score > as.cfg.AlertThreshold || testMode {
|
||||
if old, inCache := as.alertCache[s.ID]; !inCache || now.Sub(old.Timestamp) > as.renotify {
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue