Fix decisions list with --no-simu flag (#1482)

* Fix decisions list with --no-simu flag
This commit is contained in:
AlteredCoder 2022-04-27 11:05:40 +02:00 committed by GitHub
parent 0f4ab71f01
commit a645c928d4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -558,7 +558,6 @@ func BuildAlertRequestFromFilter(alerts *ent.AlertQuery, filter map[string][]str
if v[0] == "false" {
alerts = alerts.Where(alert.SimulatedEQ(false))
}
delete(filter, "simulated")
}
if _, ok := filter["origin"]; ok {
@ -642,6 +641,8 @@ func BuildAlertRequestFromFilter(alerts *ent.AlertQuery, filter map[string][]str
continue
case "sort":
continue
case "simulated":
continue
default:
return nil, errors.Wrapf(InvalidFilter, "Filter parameter '%s' is unknown (=%s)", param, value[0])
}
@ -778,10 +779,11 @@ func (c *Client) QueryAlertWithFilter(filter map[string][]string) ([]*ent.Alert,
break
}
ret = append(ret, result[0:diff]...)
} else {
ret = append(ret, result...)
}
if len(ret) == limit || len(ret) == 0 {
if len(ret) == limit || len(ret) == 0 || len(ret) < paginationSize {
c.Log.Debugf("Pagination done len(ret) = %d", len(ret))
break
}