diff --git a/cmd/dashboard/controller/notification_group.go b/cmd/dashboard/controller/notification_group.go index 8f5eef6..0569b4f 100644 --- a/cmd/dashboard/controller/notification_group.go +++ b/cmd/dashboard/controller/notification_group.go @@ -168,7 +168,7 @@ func updateNotificationGroup(c *gin.Context) (any, error) { ngf.Notifications = slices.Compact(ngf.Notifications) var count int64 - if err := singleton.DB.Model(&model.Server{}).Where("id in (?)", ngf.Notifications).Count(&count).Error; err != nil { + if err := singleton.DB.Model(&model.Notification{}).Where("id in (?)", ngf.Notifications).Count(&count).Error; err != nil { return nil, newGormError("%v", err) } if count != int64(len(ngf.Notifications)) { diff --git a/model/alertrule.go b/model/alertrule.go index b505cf5..a26e79f 100644 --- a/model/alertrule.go +++ b/model/alertrule.go @@ -85,8 +85,8 @@ func (r *AlertRule) Check(points [][]bool) (maxDuration int, passed bool) { if maxDuration < 1 { maxDuration = 1 } - for j := len(points[i]) - 1; j >= 0; j-- { - if !points[i][j] { + for j := len(points) - 1; j >= 0; j-- { + if !points[j][i] { failCount++ break }