alertconfig #21

Merged
amigan merged 5 commits from alertconfig into trunk 2024-11-02 14:28:38 -04:00
Showing only changes of commit a0cc7eedfd - Show all commits

View file

@ -277,13 +277,19 @@ type Alert struct {
func (a *Alert) ToAddAlertParams() database.AddAlertParams { func (a *Alert) ToAddAlertParams() database.AddAlertParams {
f32score := float32(a.Score.Score) f32score := float32(a.Score.Score)
f32origscore := float32(a.OrigScore) f32origscore := float32(a.OrigScore)
var origScore *float32
if a.Score.Score != a.OrigScore {
origScore = &f32origscore
}
return database.AddAlertParams{ return database.AddAlertParams{
ID: a.ID, ID: a.ID,
Time: pgtype.Timestamptz{Time: a.Timestamp, Valid: true}, Time: pgtype.Timestamptz{Time: a.Timestamp, Valid: true},
PackedTg: a.Score.ID.Pack(), PackedTg: a.Score.ID.Pack(),
Weight: &a.Weight, Weight: &a.Weight,
Score: &f32score, Score: &f32score,
OrigScore: &f32origscore, OrigScore: origScore,
} }
} }