From a0cc7eedfd3e8672687d402c637284c27a568c43 Mon Sep 17 00:00:00 2001 From: Daniel Ponte Date: Sat, 2 Nov 2024 12:40:00 -0400 Subject: [PATCH] Only set origscore when it is different --- pkg/gordio/alerting/alerting.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/pkg/gordio/alerting/alerting.go b/pkg/gordio/alerting/alerting.go index 8e4ae56..d36bb04 100644 --- a/pkg/gordio/alerting/alerting.go +++ b/pkg/gordio/alerting/alerting.go @@ -277,13 +277,19 @@ type Alert struct { func (a *Alert) ToAddAlertParams() database.AddAlertParams { f32score := float32(a.Score.Score) f32origscore := float32(a.OrigScore) + + var origScore *float32 + if a.Score.Score != a.OrigScore { + origScore = &f32origscore + } + return database.AddAlertParams{ ID: a.ID, Time: pgtype.Timestamptz{Time: a.Timestamp, Valid: true}, PackedTg: a.Score.ID.Pack(), Weight: &a.Weight, Score: &f32score, - OrigScore: &f32origscore, + OrigScore: origScore, } }