bug fixes

This commit is contained in:
uubulb 2024-12-26 16:39:15 +08:00
parent 87e01a532e
commit 915a20007e
2 changed files with 3 additions and 3 deletions

View File

@ -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)) {

View File

@ -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
}