Pkg/database/fix count decisions since by value (#1606)
* fix CountDecisionsSinceByValue to have also expired decisions
This commit is contained in:
parent
342e7f5272
commit
7fafb483ad
2 changed files with 1 additions and 2 deletions
|
@ -567,7 +567,6 @@ func (c *Client) CountDecisionsSinceByValue(decisionValue string, since time.Tim
|
|||
contains := true
|
||||
decisions := c.Ent.Decision.Query().Where(
|
||||
decision.CreatedAtGT(since),
|
||||
decision.UntilGT(time.Now().UTC()),
|
||||
)
|
||||
decisions, err = applyStartIpEndIpFilter(decisions, contains, ip_sz, start_ip, start_sfx, end_ip, end_sfx)
|
||||
if err != nil {
|
||||
|
|
|
@ -877,7 +877,7 @@ func TestGetDecisionsSinceCount(t *testing.T) {
|
|||
}
|
||||
decision2 := dbClient.Ent.Decision.Create().
|
||||
SetCreatedAt(time.Now().AddDate(0, 0, -1)).
|
||||
SetUntil(time.Now().Add(time.Hour)).
|
||||
SetUntil(time.Now().AddDate(0, 0, -1)).
|
||||
SetScenario("crowdsec/test").
|
||||
SetStartIP(start_ip).
|
||||
SetStartSuffix(start_sfx).
|
||||
|
|
Loading…
Add table
Reference in a new issue